Cat
IOobject.h
Go to the documentation of this file.
1 // $Id: $
2 #ifndef INC_IOOBJECT_H
3 #define INC_IOOBJECT_H 1
4 
5 // Include files
6 #include "Element.h"
7 #include "Interface.h"
8 #include "IOdata.h"
9 
17 class IOobject : public Element {
18 public:
19  typedef unsigned long U32;
20  typedef unsigned short U16;
21  typedef unsigned char U8;
22 
24  IOobject( );
25 
26  virtual ~IOobject( );
27 
31  void help() { info("IOobject "+name()+". No help.","IOobject::help"); };
32 
33 
41  void reset() {
42  };
43 
47  void update (){
48  };
49 
54  virtual StatusCode init() {
55  if (0==m_connection){
56  if (0==this->parent()){
57  fatal("Cannot define connection for IOobject. No parent found.",
58  "IOobject::init");
59  return StatusCode::FAILURE;
60  }
61  return setConnection(this->parent());
62  }
63  else return StatusCode::SUCCESS;
64  };
65 
66  IOdata* io(){
67  return m_io;
68  }
69 
73  virtual StatusCode read(){
74  return (dynamic_cast<Interface*>(connection()))->read(m_io);
75  }
76 
80  virtual StatusCode write() {
81  return (dynamic_cast<Interface*>(connection()))->write(m_io);
82  };
83 
84  void setAddress(U32 address){
85  m_io->setAddress(address);
86  }
87 
88  U32 address(){
89  return m_io->address();
90  }
91 
92  void dump(){
93  m_io->dump(0);
94  }
95 
96  protected:
97 
98 private:
100 };
101 #endif // INC_IOOBJECT_H
void info(std::string mymsg)
Definition: Object.h:38
void help()
Definition: IOobject.h:31
Hierarchy * connection()
Definition: Element.cpp:84
Hierarchy * m_connection
Definition: Element.h:70
StatusCode setConnection(Hierarchy *)
Definition: Element.cpp:55
U32 address()
Definition: IOdata.h:59
unsigned short U16
Definition: IOobject.h:20
void update()
Definition: IOobject.h:47
virtual StatusCode write()
Definition: IOobject.h:80
Hierarchy * parent()
Definition: Hierarchy.h:28
void dump(unsigned int printout=0)
Definition: IOdata.cpp:94
void fatal(std::string mymsg)
Definition: Object.h:41
IOdata * m_io
Definition: IOobject.h:99
unsigned long U32
Definition: IOobject.h:19
virtual StatusCode read()
Definition: IOobject.h:73
StatusCode setAddress(U32 address)
Definition: IOdata.h:51
void dump()
Definition: IOobject.h:92
virtual ~IOobject()
Destructor.
Definition: IOobject.cpp:26
Definition: IOdata.h:17
U32 address()
Definition: IOobject.h:88
void setAddress(U32 address)
Definition: IOobject.h:84
std::string name() const
Definition: Object.h:28
unsigned char U8
Definition: IOobject.h:21
virtual StatusCode init()
Definition: IOobject.h:54
IOobject()
Standard constructor.
Definition: IOobject.cpp:17
IOdata * io()
Definition: IOobject.h:66
void reset()
Definition: IOobject.h:41