Cat
Public Member Functions | Protected Attributes | List of all members
Element Class Referenceabstract

#include <inc/Element.h>

Inheritance diagram for Element:
Hierarchy Object Attrib A3PE Computer Croc CU_v1 DCU ElementWrap FEB_v1 FePGA ICECALv3 ICPhaser Interface IOobject LSDelayChipV1 MSOxxxx NI6008 Phaser Proto40MHz_v1 SeqPGA SpecsMaster UsbMLI2cBus UsbMLSpiBus

Public Member Functions

 Element ()
 Standard constructor. More...
 
virtual ~Element ()
 Destructor. More...
 
virtual void help ()=0
 
virtual StatusCode init ()=0
 
virtual void reset ()=0
 
void recursiveInitElement ()
 
void recursiveInitCommunications ()
 
virtual void update ()=0
 
StatusCode setConnection (Hierarchy *)
 
Hierarchyconnection ()
 
- Public Member Functions inherited from Hierarchy
 Hierarchy ()
 Standard constructor. More...
 
virtual ~Hierarchy ()
 Destructor. More...
 
void clear ()
 
void setParent (Hierarchy *parent)
 
Hierarchyparent ()
 
Hierarchyparent (std::string)
 
Hierarchyorigin ()
 
virtual void addChild (Hierarchy *element)
 
std::vector< Hierarchy * > children ()
 
Hierarchychild (std::string)
 
HierarchychildTyped (std::string)
 
unsigned long numberOfChildren ()
 
bool hasChildren ()
 
void delChild (Hierarchy *)
 
void delChild (std::string)
 
std::string path (std::string=std::string(""))
 
std::string pathTyped (std::string=std::string(""))
 
void tree (std::string indent=std::string(""))
 
void tree ()
 
- Public Member Functions inherited from Object
 Object ()
 Standard constructor. More...
 
virtual ~Object ()
 Destructor. More...
 
std::string name () const
 
std::string type ()
 
unsigned char id ()
 
std::string title ()
 
void msgSvc (int level, std::string msg, std::string name)
 
void msg (std::string mymsg)
 
void verbose (std::string mymsg)
 
void debug (std::string mymsg)
 
void info (std::string mymsg)
 
void warning (std::string mymsg)
 
void error (std::string mymsg)
 
void fatal (std::string mymsg)
 
void msg (std::string mymsg, std::string name)
 
void verbose (std::string mymsg, std::string name)
 
void debug (std::string mymsg, std::string name)
 
void info (std::string mymsg, std::string name)
 
void warning (std::string mymsg, std::string name)
 
void error (std::string mymsg, std::string name)
 
void fatal (std::string mymsg, std::string name)
 
void setName (std::string name)
 
void setType (std::string type)
 
void setId (unsigned char id)
 
void setTitle (std::string title)
 
void setDllName (std::string dllName)
 
std::string dllName ()
 
- Public Member Functions inherited from Attrib
 Attrib ()
 Standard constructor. More...
 
virtual ~Attrib ()
 Destructor. More...
 
bool is (int attribut)
 
void add (int attribut)
 
void remove (int attribut)
 
std::string attributs ()
 

Protected Attributes

Hierarchym_connection
 
- Protected Attributes inherited from Attrib
std::string m_attribString [10]
 

Additional Inherited Members

- Public Types inherited from Attrib
enum  Attribut {
  UNDEFINED, PASSIVE, ACTIVE, INTERFACE,
  IO, IODATA, ELEMENT, HARDWARE,
  PROCESSUS, SOFTWARE
}
 

Detailed Description

Author
Date
2006-10-23

Definition at line 14 of file Element.h.

Constructor & Destructor Documentation

◆ Element()

Element::Element ( )

Standard constructor.

Definition at line 19 of file Element.cpp.

References m_connection.

20 {
21  m_connection=0;
22 }
Hierarchy * m_connection
Definition: Element.h:70

◆ ~Element()

Element::~Element ( )
virtual

Destructor.

Definition at line 26 of file Element.cpp.

26  {
27 }

Member Function Documentation

◆ connection()

Hierarchy * Element::connection ( )

Get IO interface

Definition at line 84 of file Element.cpp.

References m_connection, Object::name(), and Object::warning().

Referenced by UsbSpiBus::clockDivider(), export_obj(), UsbI2cBus::read(), IOobject::read(), UsbSpiBus::read(), UsbSpiBus::setClockDivider(), setConnection(), UsbI2cBus::write(), IOobject::write(), and UsbSpiBus::write().

84  {
85  if (0==m_connection){
86  warning("no connection defined for "+name()+".","Element::connection");
87  return (Hierarchy*)0;
88  }
89  return m_connection;
90 }
Hierarchy * m_connection
Definition: Element.h:70
std::string name() const
Definition: Object.h:28
void warning(std::string mymsg)
Definition: Object.h:39

◆ help()

virtual void Element::help ( )
pure virtual

◆ init()

virtual StatusCode Element::init ( )
pure virtual

◆ recursiveInitCommunications()

void Element::recursiveInitCommunications ( )

Triggers a recursive call to initCommunications() for the full hierarchy

Returns
void

Definition at line 44 of file Element.cpp.

References Hierarchy::children().

Referenced by export_obj().

44  {
45  std::vector<Hierarchy*> list = children();
46  std::vector<Hierarchy*>::const_iterator iter;
47  for (iter=list.begin();iter!=list.end();iter++){
48  dynamic_cast<Element*>((*iter))->recursiveInitCommunications();
49  }
50 }
std::vector< Hierarchy * > children()
Definition: Hierarchy.h:33
void recursiveInitCommunications()
Definition: Element.cpp:44

◆ recursiveInitElement()

void Element::recursiveInitElement ( )

Triggers a recursive call to init() for the full hierarchy

Returns
void

Definition at line 32 of file Element.cpp.

References Hierarchy::children(), and init().

Referenced by export_obj().

32  {
33  init();
34  std::vector<Hierarchy*> list = children();
35  std::vector<Hierarchy*>::iterator iter;
36  for (iter=list.begin() ; iter!=list.end() ; ++iter){
37  dynamic_cast<Element*>((*iter))->recursiveInitElement();
38  }
39 }
std::vector< Hierarchy * > children()
Definition: Hierarchy.h:33
virtual StatusCode init()=0
void recursiveInitElement()
Definition: Element.cpp:32

◆ reset()

virtual void Element::reset ( )
pure virtual

Resets the Element so that is is in a standard and safe situation. Different from Element::init which configure the Element. Element::reset() is more an Emergency pull. It is often/usually called by the recursiveInitElement method at the start of the program.

Implemented in A3PE, LSDelayChipV1, ICECALv3, ICPhaser, MSOxxxx, Phaser, UsbFTInterface, UsbFTMLInterface, NI6008, SpecsInterface, SpecsMaster, SpecsSlave, SpecsParallelBus, Computer, FePGA, SeqPGA, Proto40MHz_v1, FEB_v1, CU_v1, UsbSpiBus, UsbMLI2cBus, UsbMLSpiBus, UsbI2cBus, Croc, Interface, IOobject, DCU, ElementWrap, and InterfaceWrap.

Referenced by export_obj().

◆ setConnection()

StatusCode Element::setConnection ( Hierarchy connection)

Define IO interface

Definition at line 55 of file Element.cpp.

References connection(), Object::debug(), StatusCode::FAILURE, Object::fatal(), Attrib::INTERFACE, Attrib::is(), m_connection, Object::name(), Hierarchy::parent(), StatusCode::SUCCESS, and Object::type().

Referenced by export_obj(), UsbMLSpiBus::init(), UsbMLI2cBus::init(), UsbI2cBus::init(), UsbSpiBus::init(), and IOobject::init().

55  {
56  if (0==connection){
57  fatal("Try to define a connection with a null pointer.",
58  "Element::setConnection");
59  return StatusCode::FAILURE;
60  }
61  if (connection->is(Attrib::INTERFACE)){
62  m_connection=dynamic_cast<Hierarchy*>(connection);
63  return StatusCode::SUCCESS;
64  }
65  else {
66  debug(connection->name()+
67  " is not a Attrib::INTERFACE hardware. Connection refused.",
68  "Element::setConnection");
69  if (0!=connection->parent()){
70  return setConnection(connection->parent());
71  }
72  else{
73  fatal("Could not find a connection for element "+
74  name()+"["+type()+"].","element::setConnection");
75  return StatusCode::FAILURE;
76  }
77  }
78 }
Hierarchy * connection()
Definition: Element.cpp:84
Hierarchy * m_connection
Definition: Element.h:70
StatusCode setConnection(Hierarchy *)
Definition: Element.cpp:55
bool is(int attribut)
Definition: Attrib.h:50
Hierarchy * parent()
Definition: Hierarchy.h:28
void fatal(std::string mymsg)
Definition: Object.h:41
void debug(std::string mymsg)
Definition: Object.h:37
std::string name() const
Definition: Object.h:28
std::string type()
Definition: Object.h:29

◆ update()

virtual void Element::update ( )
pure virtual

Member Data Documentation

◆ m_connection

Hierarchy* Element::m_connection
protected

The documentation for this class was generated from the following files: