Jpp
Public Member Functions | Protected Attributes | List of all members
JNET::JSubscription Class Reference

ControlHost subscription. More...

#include <JControlHost.hh>

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

Public Member Functions

 JSubscription (const JSubscription_t sub, 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

ControlHost subscription.

Definition at line 49 of file JControlHost.hh.

Constructor & Destructor Documentation

◆ JSubscription()

JNET::JSubscription::JSubscription ( const JSubscription_t  sub,
const JTag tag 
)
inline

Constructor.

Parameters
subsubscription
tagtag

Definition at line 59 of file JControlHost.hh.

60  :
61  JTag (tag),
62  subscription(sub)
63  {}

Member Function Documentation

◆ getSubscription()

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

Get subscription type.

Returns
subscription

Definition at line 71 of file JControlHost.hh.

72  {
73  return subscription;
74  }

◆ toString()

std::string JNET::JSubscription::toString ( ) const
inline

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  }

◆ getTag() [1/2]

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  }

◆ getTag() [2/2]

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  }

◆ setTag() [1/2]

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  }

◆ setTag() [2/2]

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  }

◆ getID()

JTag_t JNET::JTag::getID ( ) const
inlineinherited

Get identifier.

Returns
identifier

Definition at line 143 of file JTag.hh.

144  {
145  return id;
146  }

◆ setID()

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  }

◆ operator std::string()

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  }

◆ c_str()

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  }

◆ operator[]()

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  }

Member Data Documentation

◆ subscription

JSubscription_t JNET::JSubscription::subscription
protected

Definition at line 89 of file JControlHost.hh.

◆ tag

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

Definition at line 247 of file JTag.hh.

◆ id

JTag_t JNET::JTag::id
inherited

Definition at line 248 of file JTag.hh.

◆ @47

union { ... }

The documentation for this class was generated from the following file:
JNET::JSubscription::subscription
JSubscription_t subscription
Definition: JControlHost.hh:89
JNET::JTag::JTag
JTag()
Default constructor.
Definition: JTag.hh:40
JNET::JTag::tag
char tag[TAGSIZE]
Definition: JTag.hh:247
JNET::TAGSIZE
static const size_t TAGSIZE
Definition: JTag.hh:29
JNET::JTag::toString
std::string toString() const
Convert tag to string.
Definition: JTag.hh:167
JNET::JTag::id
JTag_t id
Definition: JTag.hh:248