Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Protected Attributes | List of all members
JNET::JSubscriptionAny Struct Reference

Auxiliary class for any subscription. More...

#include <JControlHost.hh>

Inheritance diagram for JNET::JSubscriptionAny:
JNET::JSubscription JNET::JTag

Public Member Functions

 JSubscriptionAny (const JTag &tag)
 Constructor. More...
 
JSubscription_t getSubscription () const
 Get subscription type. More...
 
std::string toString () const
 Convert subscription to string. More...
 
const JTaggetTag () const
 Get tag. More...
 
JTaggetTag ()
 Get tag. More...
 
void setTag (const JTag &tag)
 Set tag. More...
 
void setTag (const std::string &tag)
 Set tag. More...
 
JTag_t getID () const
 Get identifier. More...
 
bool setID (const JTag_t id)
 Set identifier. More...
 
 operator std::string () const
 Type conversion operators. More...
 
const char * c_str () const
 C-string. More...
 
const char operator[] (int i) const
 Get character. More...
 

Protected Attributes

JSubscription_t subscription
 
union {
   char   tag [TAGSIZE]
 
   JTag_t   id
 
}; 
 

Detailed Description

Auxiliary class for any subscription.

Definition at line 113 of file JControlHost.hh.

Constructor & Destructor Documentation

JNET::JSubscriptionAny::JSubscriptionAny ( const JTag tag)
inline

Constructor.

Parameters
tagtag

Definition at line 121 of file JControlHost.hh.

121  :
123  {}
JSubscription(const JSubscription_t sub, const JTag &tag)
Constructor.
Definition: JControlHost.hh:59

Member Function Documentation

JSubscription_t JNET::JSubscription::getSubscription ( ) const
inlineinherited

Get subscription type.

Returns
subscription

Definition at line 71 of file JControlHost.hh.

72  {
73  return subscription;
74  }
JSubscription_t subscription
Definition: JControlHost.hh:89
std::string JNET::JSubscription::toString ( ) const
inlineinherited

Convert subscription to string.

Returns
subscription

Definition at line 82 of file JControlHost.hh.

83  {
84  return std::string(1, (char) subscription) + " " + JTag::toString();
85  }
std::string toString() const
Convert tag to string.
Definition: JTag.hh:167
JSubscription_t subscription
Definition: JControlHost.hh:89
const JTag& JNET::JTag::getTag ( ) const
inlineinherited

Get tag.

Returns
tag

Definition at line 82 of file JTag.hh.

83  {
84  return static_cast<const JTag&>(*this);
85  }
ControlHost tag.
Definition: JTag.hh:35
JTag& JNET::JTag::getTag ( )
inlineinherited

Get tag.

Returns
tag

Definition at line 93 of file JTag.hh.

94  {
95  return static_cast<JTag&>(*this);
96  }
ControlHost tag.
Definition: JTag.hh:35
void JNET::JTag::setTag ( const JTag tag)
inlineinherited

Set tag.

Parameters
tagtag
Returns
true if OK; else false

Definition at line 105 of file JTag.hh.

106  {
107  id = tag.getID();
108  }
JTag_t getID() const
Get identifier.
Definition: JTag.hh:143
void JNET::JTag::setTag ( const std::string &  tag)
inlineinherited

Set tag.

Parameters
tagtag
Returns
true if OK; else false

Definition at line 117 of file JTag.hh.

118  {
119  if (!tag.empty() && tag.size() <= TAGSIZE) {
120 
121  size_t i = 0;
122 
123  for ( ; i < tag.size(); ++i) {
124  this->tag[i] = tag[i];
125  }
126 
127  for ( ; i < TAGSIZE; ++i) {
128  this->tag[i] = '\0';
129  }
130 
131  } else {
132 
133  return throw(JControlHostException("JTag::setTag() invalid tag length."));
134  }
135  }
char tag[TAGSIZE]
Definition: JTag.hh:247
static const size_t TAGSIZE
Definition: JTag.hh:29
JTag_t JNET::JTag::getID ( ) const
inlineinherited

Get identifier.

Returns
identifier

Definition at line 143 of file JTag.hh.

144  {
145  return id;
146  }
JTag_t id
Definition: JTag.hh:248
bool JNET::JTag::setID ( const JTag_t  id)
inlineinherited

Set identifier.

Returns
identifier

Definition at line 154 of file JTag.hh.

155  {
156  this->id = id;
157 
158  return true;
159  }
JTag_t id
Definition: JTag.hh:248
JNET::JTag::operator std::string ( ) const
inlineinherited

Type conversion operators.

Returns
tag

Definition at line 184 of file JTag.hh.

185  {
186  return toString();
187  }
std::string toString() const
Convert tag to string.
Definition: JTag.hh:167
const char* JNET::JTag::c_str ( ) const
inlineinherited

C-string.

Returns
tag

Definition at line 195 of file JTag.hh.

196  {
197  return tag;
198  }
char tag[TAGSIZE]
Definition: JTag.hh:247
const char JNET::JTag::operator[] ( int  i) const
inlineinherited

Get character.

Parameters
iindex
Returns
character at index

Definition at line 207 of file JTag.hh.

208  {
209  return tag[i];
210  }
char tag[TAGSIZE]
Definition: JTag.hh:247

Member Data Documentation

JSubscription_t JNET::JSubscription::subscription
protectedinherited

Definition at line 89 of file JControlHost.hh.

char JNET::JTag::tag[TAGSIZE]
inherited

Definition at line 247 of file JTag.hh.

JTag_t JNET::JTag::id
inherited

Definition at line 248 of file JTag.hh.

union { ... }

The documentation for this struct was generated from the following file: