This is Unofficial EPICS BASE Doxygen Site
epics::pvData::Scalar Class Reference

This class implements introspection object for Scalar. More...

#include "pvIntrospect.h"

+ Inheritance diagram for epics::pvData::Scalar:
+ Collaboration diagram for epics::pvData::Scalar:

Public Types

typedef Scalarreference
 
typedef const Scalarconst_reference
 
- Public Types inherited from epics::pvData::Field
enum  { isField =1 }
 

Public Member Functions

 POINTER_DEFINITIONS (Scalar)
 
virtual ~Scalar ()
 
ScalarType getScalarType () const
 
virtual std::string getID () const OVERRIDE
 
virtual std::ostream & dump (std::ostream &o) const OVERRIDE FINAL
 
virtual void serialize (ByteBuffer *buffer, SerializableControl *control) const OVERRIDE
 
virtual void deserialize (ByteBuffer *buffer, DeserializableControl *control) OVERRIDE FINAL
 
std::tr1::shared_ptr< PVScalarbuild () const
 
- Public Member Functions inherited from epics::pvData::Field
 POINTER_DEFINITIONS (Field)
 
virtual ~Field ()
 
Type getType () const
 
std::tr1::shared_ptr< PVFieldbuild () const
 
- Public Member Functions inherited from epics::pvData::Serializable
virtual ~Serializable ()
 

Protected Member Functions

 Scalar (ScalarType scalarType)
 
- Protected Member Functions inherited from epics::pvData::Field
 Field (Type type)
 
void cacheCleanup ()
 

Friends

class FieldCreate
 
class ScalarArray
 
class BoundedScalarArray
 
class FixedScalarArray
 
class BoundedString
 

Additional Inherited Members

- Static Public Attributes inherited from epics::pvData::Field
static size_t num_instances
 

Detailed Description

This class implements introspection object for Scalar.

Definition at line 397 of file pvIntrospect.h.

Member Typedef Documentation

Definition at line 402 of file pvIntrospect.h.

Definition at line 401 of file pvIntrospect.h.

Constructor & Destructor Documentation

epics::pvData::Scalar::~Scalar ( )
virtual

Definition at line 126 of file FieldCreateFactory.cpp.

127 {
128  cacheCleanup();
129 }
epics::pvData::Scalar::Scalar ( ScalarType  scalarType)
protected

Definition at line 119 of file FieldCreateFactory.cpp.

120  : Field(scalar),scalarType(scalarType)
121 {
122  if(scalarType<0 || scalarType>MAX_SCALAR_TYPE)
123  THROW_EXCEPTION2(std::invalid_argument, "Can't construct Scalar from invalid ScalarType");
124 }
#define THROW_EXCEPTION2(TYPE, MSG)
#define MAX_SCALAR_TYPE
Definition: pvIntrospect.h:280

Member Function Documentation

std::tr1::shared_ptr< PVScalar > epics::pvData::Scalar::build ( ) const

Allocate a new instance

Version
Added after 7.0.0

Definition at line 186 of file FieldCreateFactory.cpp.

187 {
188  return getPVDataCreate()->createPVScalar(std::tr1::static_pointer_cast<const Scalar>(shared_from_this()));
189 }
FORCE_INLINE const PVDataCreatePtr & getPVDataCreate()
Definition: pvData.h:1648
void epics::pvData::Scalar::deserialize ( ByteBuffer buffer,
DeserializableControl flusher 
)
virtual

Deserialize buffer.

Parameters
bufferserialization buffer.
flusherdeserialization control.

Implements epics::pvData::Serializable.

Definition at line 180 of file FieldCreateFactory.cpp.

180  {
181  // must be done via FieldCreate
182  throw std::runtime_error("not valid operation, use FieldCreate::deserialize instead");
183 }
std::ostream & epics::pvData::Scalar::dump ( std::ostream &  o) const
virtual

Puts the string representation to the stream.

Parameters
ooutput stream.
Returns
The output stream.

Implements epics::pvData::Field.

Definition at line 131 of file FieldCreateFactory.cpp.

132 {
133  return o << format::indent() << getID();
134 }
virtual std::string getID() const OVERRIDE
string epics::pvData::Scalar::getID ( ) const
virtual

Get the identification string.

Returns
The identification string, can be empty.

Implements epics::pvData::Field.

Reimplemented in epics::pvData::BoundedString.

Definition at line 136 of file FieldCreateFactory.cpp.

137 {
138  static const string idScalarLUT[] = {
139  "boolean", // pvBoolean
140  "byte", // pvByte
141  "short", // pvShort
142  "int", // pvInt
143  "long", // pvLong
144  "ubyte", // pvUByte
145  "ushort", // pvUShort
146  "uint", // pvUInt
147  "ulong", // pvULong
148  "float", // pvFloat
149  "double", // pvDouble
150  "string" // pvString
151  };
152  return idScalarLUT[scalarType];
153 }
ScalarType epics::pvData::Scalar::getScalarType ( ) const
inline

Get the scalarType

Returns
the scalarType

Definition at line 407 of file pvIntrospect.h.

407 {return scalarType;}
epics::pvData::Scalar::POINTER_DEFINITIONS ( Scalar  )
void epics::pvData::Scalar::serialize ( ByteBuffer buffer,
SerializableControl flusher 
) const
virtual

Serialize field into given buffer.

Parameters
bufferserialization buffer.
flusherflush interface.

Implements epics::pvData::Serializable.

Reimplemented in epics::pvData::BoundedString.

Definition at line 175 of file FieldCreateFactory.cpp.

175  {
176  control->ensureBuffer(1);
177  buffer->putByte(getTypeCodeLUT(scalarType));
178 }

Friends And Related Function Documentation

friend class BoundedScalarArray
friend

Definition at line 427 of file pvIntrospect.h.

friend class BoundedString
friend

Definition at line 429 of file pvIntrospect.h.

friend class FieldCreate
friend

Definition at line 425 of file pvIntrospect.h.

friend class FixedScalarArray
friend

Definition at line 428 of file pvIntrospect.h.

friend class ScalarArray
friend

Definition at line 426 of file pvIntrospect.h.


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