Cat
Public Types | Public Member Functions | Protected Attributes | Private Attributes | List of all members
Attrib Class Reference

#include <Attrib.h>

Inheritance diagram for Attrib:
Object Application Data Hierarchy Histo1D Histo2D IOdata Plot Processus

Public Types

enum  Attribut {
  UNDEFINED, PASSIVE, ACTIVE, INTERFACE,
  IO, IODATA, ELEMENT, HARDWARE,
  PROCESSUS, SOFTWARE
}
 

Public Member Functions

 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

std::string m_attribString [10]
 

Private Attributes

std::vector< int > m_attributs
 

Detailed Description

Define the attributs of objects. Define a basic set of attributs for class objects;

Author
Frédéric Machefert
Date
October 27, 2006

Definition at line 27 of file Attrib.h.

Member Enumeration Documentation

◆ Attribut

Enumerator
UNDEFINED 
PASSIVE 
ACTIVE 
INTERFACE 
IO 
IODATA 
ELEMENT 
HARDWARE 
PROCESSUS 
SOFTWARE 

Definition at line 29 of file Attrib.h.

29  {
30  UNDEFINED,
31  PASSIVE,
32  ACTIVE,
33  INTERFACE,
34  IO,
35  IODATA,
36  ELEMENT,
37  HARDWARE,
38  PROCESSUS,
39  SOFTWARE
40  }; // array m_attribString must be changed into Attrib::Attrib if this enu is modified.

Constructor & Destructor Documentation

◆ Attrib()

Attrib::Attrib ( )

Standard constructor.

Definition at line 31 of file Attrib.cpp.

References add(), m_attribString, m_attributs, and UNDEFINED.

31  {
32  m_attribString[0] = std::string("UNDEFINED");
33  m_attribString[1] = std::string("PASSIVE");
34  m_attribString[2] = std::string("ACTIVE");
35  m_attribString[3] = std::string("INTERFACE");
36  m_attribString[4] = std::string("IO");
37  m_attribString[5] = std::string("IODATA");
38  m_attribString[6] = std::string("ELEMENT");
39  m_attribString[7] = std::string("HARDWARE");
40  m_attribString[8] = std::string("PROCESSUS");
41  m_attribString[9] = std::string("SOFTWARE");
42  m_attributs.clear();
44 }
void add(int attribut)
Definition: Attrib.h:67
std::string m_attribString[10]
Definition: Attrib.h:105
std::vector< int > m_attributs
Definition: Attrib.h:108

◆ ~Attrib()

Attrib::~Attrib ( )
virtual

Destructor.

Definition at line 49 of file Attrib.cpp.

49 {}

Member Function Documentation

◆ add()

void Attrib::add ( int  attribut)
inline

Add an attribut

Definition at line 67 of file Attrib.h.

References m_attributs, and UNDEFINED.

Referenced by A3PE::A3PE(), Attrib(), SpecsMezzanine::cmdline(), Computer::Computer(), CU_v1::CU_v1(), export_obj(), FEB_v1::FEB_v1(), FePGA::FePGA(), ICECALv3::ICECALv3(), ICPhaser::ICPhaser(), Application::initialize(), Interface::Interface(), IOdata::IOdata(), IOobject::IOobject(), MSOxxxx::MSOxxxx(), Phaser::Phaser(), Processus::Processus(), Proto40MHz_v1::Proto40MHz_v1(), remove(), SeqPGA::SeqPGA(), TestSPI::setAddress(), TestI2C::setAddress(), SpecsSlave::setAddress(), SpecsMaster::SpecsMaster(), SpecsSlave::SpecsSlave(), and FePGA::transmitSpi().

67  {
68  if (attribut!=Attrib::UNDEFINED) remove(Attrib::UNDEFINED);
69  bool duplicate = false ;
70  std::vector<int>::const_iterator iter ;
71  for ( iter = m_attributs.begin() ;
72  iter != m_attributs.end() ;
73  ++iter ) {
74  if ( attribut == (*iter) ) {
75  duplicate = true ;
76  }
77  }
78  if (!duplicate) {
79  m_attributs.push_back( attribut );
80  }
81  }
std::vector< int > m_attributs
Definition: Attrib.h:108

◆ attributs()

std::string Attrib::attributs ( )

Print the Attrib of an Object

Definition at line 54 of file Attrib.cpp.

References images::index, m_attribString, and m_attributs.

Referenced by export_obj(), and remove().

54  {
55  std::string output;
56  std::vector<int>::iterator iter ;
57  for ( unsigned int index = 0 ; index < m_attributs.size() ; ++index ) {
58  if ( m_attributs.size() - index > 1 ) {
59  output.append(m_attribString[m_attributs[index]]);
60  output.append(":");
61  }
62  else {
63  output.append(m_attribString[m_attributs[index]]);
64  }
65  }
66  return output;
67 }
list index
Definition: images.py:1021
std::string m_attribString[10]
Definition: Attrib.h:105
std::vector< int > m_attributs
Definition: Attrib.h:108

◆ is()

bool Attrib::is ( int  attribut)
inline

Test for an attribut

Definition at line 50 of file Attrib.h.

References m_attributs.

Referenced by export_obj(), and Element::setConnection().

51  {
52  std::vector<int>::const_iterator iter ;
53  for ( iter = m_attributs.begin() ;
54  iter != m_attributs.end() ;
55  ++iter ) {
56  if ( attribut == (*iter) ) {
57  return true;
58  }
59  }
60  return false;
61  }
std::vector< int > m_attributs
Definition: Attrib.h:108

◆ remove()

void Attrib::remove ( int  attribut)
inline

Remove an attribut

Definition at line 86 of file Attrib.h.

References add(), attributs(), m_attributs, and UNDEFINED.

Referenced by export_obj().

86  {
87  std::vector<int>::iterator iter , toremove ;
88  for ( iter = m_attributs.begin() ;
89  iter != m_attributs.end() ;
90  ++iter ) {
91  if ( attribut == (*iter) ) {
92  toremove = iter;
93  }
94  }
95  m_attributs.erase (toremove);
96  if(0==m_attributs.size()) add(Attrib::UNDEFINED);
97  }
void add(int attribut)
Definition: Attrib.h:67
std::vector< int > m_attributs
Definition: Attrib.h:108

Member Data Documentation

◆ m_attribString

std::string Attrib::m_attribString[10]
protected

Definition at line 105 of file Attrib.h.

Referenced by Attrib(), and attributs().

◆ m_attributs

std::vector<int> Attrib::m_attributs
private

Definition at line 108 of file Attrib.h.

Referenced by add(), Attrib(), attributs(), is(), and remove().


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