source: DMM/src/Position.cxx @ 416

Last change on this file since 416 was 373, checked in by campagne, 17 years ago

Data Model for MEMPHYS

File size: 2.0 KB
Line 
1#include "DMM/Position.h"
2
3
4MEMPHYS::DMM::Position::Position(MEMPHYS::DMM::IDataServices& aService)   
5  :MEMPHYS::DMM::BaseData(aService)
6  ,m_x(0)
7  ,m_y(0)
8  ,m_z(0)
9{
10  std::cout << "Create Position("<<this<<")"<<std::endl;
11}//Ctor
12//----------------------------------------------------------
13MEMPHYS::DMM::Position::Position(const MEMPHYS::DMM::Position& aPosition)
14  :MEMPHYS::DMM::BaseData(aPosition)
15  ,m_x(aPosition.m_x)
16  ,m_y(aPosition.m_y)
17  ,m_z(aPosition.m_z)
18{
19  std::cout << "Copy Create Position("<<this<<") from ("<< &aPosition <<")" <<std::endl;
20}//CCtor
21//----------------------------------------------------------
22MEMPHYS::DMM::Position& MEMPHYS::DMM::Position::operator=(const MEMPHYS::DMM::Position& aPosition) {
23  std::cout << "Assign ("<<&aPosition<<") to (" << this << ")" <<std::endl;
24  if (&aPosition != this) {
25    m_x = aPosition.m_x;
26    m_y = aPosition.m_y;
27    m_z = aPosition.m_z;
28  }
29  return *this;
30}//op=
31//----------------------------------------------------------
32void* MEMPHYS::DMM::Position::cast(const std::string& aClass) const {
33  if(aClass=="Slash::Store::IStorable") {
34    return (void*)static_cast<const Slash::Store::IStorable*>(this);
35  } else if(aClass=="MEMPHYS::DMM::Position") {
36    return (void*)static_cast<const MEMPHYS::DMM::Position*>(this);
37  } else if(aClass=="MEMPHYS:DMM::BaseData") {
38    return (void*)static_cast<const MEMPHYS::DMM::BaseData*>(this);
39  } else {
40    return 0;
41  } 
42}//cast
43//----------------------------------------------------------
44bool  MEMPHYS::DMM::Position::visit(Slash::Store::IConstVisitor&) const {
45  return true;
46}//visit
47//----------------------------------------------------------
48bool MEMPHYS::DMM::Position::read(Slash::Store::IVisitor&) {
49  return true;
50}//read
51//----------------------------------------------------------
52void MEMPHYS::DMM::Position::dump(std::ostream& f,
53                               const std::string& option) {
54  MEMPHYS::DMM::BaseData::dump(f,option);
55  f << " (x,y,z) " << m_x << ", " << m_y << ", "<< m_z << ", "
56    << std::endl;
57}//dump
58
59
Note: See TracBrowser for help on using the repository browser.