Jpp  debug
the software that should make you happy
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...
 
void setTag (const JTag_t id)
 Set tag. More...
 
JTag_t getID () const
 Get 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
 
JTag_t id
 

Detailed Description

Auxiliary class for any subscription.

Definition at line 114 of file JControlHost.hh.

Constructor & Destructor Documentation

◆ JSubscriptionAny()

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

Constructor.

Parameters
tagtag

Definition at line 122 of file JControlHost.hh.

122  :
124  {}
JSubscription(const JSubscription_t sub, const JTag &tag)
Constructor.
Definition: JControlHost.hh:60
@ SUBSCRIBE_ANY
Definition: JControlHost.hh:42

Member Function Documentation

◆ getSubscription()

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

Get subscription type.

Returns
subscription

Definition at line 72 of file JControlHost.hh.

73  {
74  return subscription;
75  }
JSubscription_t subscription
Definition: JControlHost.hh:90

◆ toString()

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

Convert subscription to string.

Returns
subscription

Definition at line 83 of file JControlHost.hh.

84  {
85  return std::string(1, (char) subscription) + " " + JTag::toString();
86  }
std::string toString() const
Convert tag to string.
Definition: JTag.hh:171

◆ getTag() [1/2]

const JTag& JNET::JTag::getTag ( ) const
inlineinherited

Get tag.

Returns
tag

Definition at line 86 of file JTag.hh.

87  {
88  return static_cast<const JTag&>(*this);
89  }
ControlHost tag.
Definition: JTag.hh:38

◆ getTag() [2/2]

JTag& JNET::JTag::getTag ( )
inlineinherited

Get tag.

Returns
tag

Definition at line 97 of file JTag.hh.

98  {
99  return static_cast<JTag&>(*this);
100  }

◆ setTag() [1/3]

void JNET::JTag::setTag ( const JTag tag)
inlineinherited

Set tag.

Parameters
tagtag

Definition at line 108 of file JTag.hh.

109  {
110  id = tag.getID();
111  }
JTag_t getID() const
Get identifier.
Definition: JTag.hh:160

◆ setTag() [2/3]

void JNET::JTag::setTag ( const std::string &  tag)
inlineinherited

Set tag.

This method may throw an exception.

Parameters
tagtag

Definition at line 121 of file JTag.hh.

122  {
123  if (!tag.empty() && tag.size() <= TAGSIZE) {
124 
125  char* __p = (char*) &(this->id);
126 
127  size_t i = 0;
128 
129  for ( ; i != tag.size(); ++i) {
130  __p[i] = tag[i];
131  }
132 
133  for ( ; i != TAGSIZE; ++i) {
134  __p[i] = '\0';
135  }
136 
137  } else {
138 
139  THROW(JControlHostException, "Invalid tag length <" << tag << "> " << tag.size());
140  }
141  }
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:712
Exception for ControlHost.
Definition: JException.hh:486
static const size_t TAGSIZE
Size of ControlHost tag.
Definition: JTag.hh:32

◆ setTag() [3/3]

void JNET::JTag::setTag ( const JTag_t  id)
inlineinherited

Set tag.

Parameters
ididentifier

Definition at line 149 of file JTag.hh.

150  {
151  this->id = id;
152  }
JTag_t id
Definition: JTag.hh:254

◆ getID()

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

Get identifier.

Returns
identifier

Definition at line 160 of file JTag.hh.

161  {
162  return id;
163  }

◆ operator std::string()

JNET::JTag::operator std::string ( ) const
inlineinherited

Type conversion operators.

Returns
tag

Definition at line 190 of file JTag.hh.

191  {
192  return toString();
193  }

◆ c_str()

const char* JNET::JTag::c_str ( ) const
inlineinherited

C-string.

Returns
tag

Definition at line 201 of file JTag.hh.

202  {
203  return (const char*) &(this->id);
204  }

◆ operator[]()

const char JNET::JTag::operator[] ( int  i) const
inlineinherited

Get character.

Parameters
iindex
Returns
character at index

Definition at line 213 of file JTag.hh.

214  {
215  const char* __p = (const char*) &(this->id);
216 
217  return __p[i];
218  }

Member Data Documentation

◆ subscription

JSubscription_t JNET::JSubscription::subscription
protectedinherited

Definition at line 90 of file JControlHost.hh.

◆ id

JTag_t JNET::JTag::id
protectedinherited

Definition at line 254 of file JTag.hh.


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