openDAQ
Open data acquisition platform
StructBuilderPtr Class Reference

Builder component of Struct objects. Contains setter methods to configure the Struct parameters, and a build method that builds the Struct object. More...

+ Inheritance diagram for StructBuilderPtr:
+ Collaboration diagram for StructBuilderPtr:

Detailed Description

Builder component of Struct objects. Contains setter methods to configure the Struct parameters, and a build method that builds the Struct object.

Public Member Functions

StructPtr build () const
 Builds and returns a Struct object using the currently set values of the Builder. More...
 
StructTypePtr getStructType () const
 Gets the Struct's type. More...
 
ListPtr< IStringgetFieldNames () const
 Gets a list of all Struct field names. More...
 
StructBuilderPtr setFieldValues (const ListPtr< IBaseObject > values) const
 Sets a list of all Struct field values. More...
 
ListPtr< IBaseObjectgetFieldValues () const
 Gets a list of all Struct field values. More...
 
StructBuilderPtr set (const StringPtr &name, const BaseObjectPtr &field) const
 Sets the value of a field with the given name. More...
 
BaseObjectPtr get (const StringPtr &name) const
 Gets the value of a field with the given name. More...
 
DictPtr< IString, IBaseObjectgetAsDictionary () const
 Gets the field names and values of the Struct as a Dictionary. More...
 
Bool hasField (const StringPtr &name) const
 Checks whether a field with the given name exists in the Struct. More...
 
- Public Member Functions inherited from ObjectPtr< IStructBuilder >
 ObjectPtr ()
 Creates a smart pointer with no wrapped interface.
 
 ObjectPtr (std::nullptr_t)
 Creates a smart pointer with no wrapped interface.
 
 ObjectPtr (const ObjectPtr< IStructBuilder > &objPtr)
 Creates a smart pointer from another smart pointer. More...
 
 ObjectPtr (ObjectPtr< IStructBuilder > &&objPtr) noexcept
 Creates a smart pointer from another smart pointer with move semantics. More...
 
 ObjectPtr (const ObjectPtr< U > &objPtr)
 Creates a smart pointer from another smart pointer of a different interface type. More...
 
 ObjectPtr (ObjectPtr< U > &&objPtr)
 Creates a smart pointer from another smart pointer of a different interface type with move semantics. More...
 
 ObjectPtr (IStructBuilder *&obj)
 Creates a smart pointer from an interface pointer. More...
 
 ObjectPtr (IStructBuilder *&&obj)
 Creates a smart pointer from an interface pointer with move semantics. More...
 
 ObjectPtr (IWeakRef *obj)
 Creates a smart pointer from a weak reference interface pointer. More...
 
 ObjectPtr (const wchar_t *value)
 Creates a string object smart pointer from UTF16 null terminated sequence. More...
 
 ObjectPtr (ConstCharPtr value)
 Creates a string object smart pointer from UTF8 null terminated sequence. More...
 
 ObjectPtr (const U &value)
 Creates a smart pointer wrapper from value type. More...
 
virtual ~ObjectPtr ()
 Destructor. More...
 
bool equals (ObjectPtr< IBaseObject > other) const
 Compares object to another object for equality. More...
 
IStructBuilderdetach ()
 Disassociates this smart pointer object from the interface that it represents. More...
 
void dispose () const
 Disposes all references held by the object. More...
 
void release ()
 Resets the wrapped interface to nullptr. More...
 
IStructBuilderaddRefAndReturn () const
 Increments the reference count and returns the interface. More...
 
 operator IStructBuilder * () const
 Casts the pointer to the wrapped interface. More...
 
bool assigned () const
 Checks if the smart pointer is not empty.
 
IStructBuildergetObject () const
 Gets the pointer to the wrapped interface. More...
 
IStructBuilder ** addressOf ()
 Gets the address of the pointer to the wrapped interface. More...
 
IStructBuilder ** operator& ()
 Gets the address of the pointer to the wrapped interface. More...
 
U * as (bool borrow=false) const
 Casts the wrapped interface to another interface. More...
 
U * asOrNull (bool borrow=false) const
 Casts the wrapped interface to another interface. More...
 
Ptr asPtr (bool borrow=false) const
 Casts the wrapped interface to another interface and wraps in a smart pointer. More...
 
Ptr asPtrOrNull (bool borrow=false) const
 Casts the wrapped interface to another interface and wraps in a smart pointer. More...
 
bool supportsInterface () const
 Checks if the wrapped interface supports another interface. More...
 
bool supportsInterface (const IntfID &id) const
 Checks if the wrapped interface supports another interface using the interface ID. More...
 
CoreType getCoreType () const
 Gets the object's CoreType. More...
 
ObjectPtr< IBaseObjectconvertTo (CoreType ct) const
 Converts the object to the specified CoreType. More...
 
SizeT getHashCode () const
 Returns hash code of the object. More...
 
ObjectPtr< IStringtoString () const
 Converts the object to the string object. More...
 
void freeze () const
 Freezes the object. More...
 
Bool isFrozen () const
 Checks if the object is frozen. More...
 
void dispatch (const ObjectPtr< IBaseObject > &params) const
 Calls the stored callback. More...
 
void dispatch () const
 Calls the stored callback without any parameters. More...
 
void execute () const
 Calls the stored callback without any parameters. More...
 
void execute (Params... params) const
 Calls the stored callback. More...
 
ObjectPtr< IBaseObjectcall (Params... params) const
 Calls the stored callback and returns the result. More...
 
bool isBorrowed () const
 Checks if the reference is borrowed. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from ObjectPtr< IStructBuilder >
static InterfaceToSmartPtr< U >::SmartPtr Borrow (IStructBuilder *&obj)
 Borrows an interface. More...
 
static InterfaceToSmartPtr< V >::SmartPtr Borrow (U *&obj)
 Borrows an interface from the interface of another type. More...
 
static InterfaceToSmartPtr< U >::SmartPtr Adopt (IStructBuilder *obj)
 Adopts an interface. More...
 
static Bool Equals (const ObjectPtr< IBaseObject > &a, const ObjectPtr< IBaseObject > &b)
 Value based comparison of two objects. If both objects are nullptr, they are considered to be equal. More...
 

Member Function Documentation

◆ build()

StructPtr build ( ) const
inline

Builds and returns a Struct object using the currently set values of the Builder.

Returns
The built Struct.

◆ get()

BaseObjectPtr get ( const StringPtr name) const
inline

Gets the value of a field with the given name.

Parameters
nameThe name of the queried field.
Returns
The value of the field.

◆ getAsDictionary()

DictPtr<IString, IBaseObject> getAsDictionary ( ) const
inline

Gets the field names and values of the Struct as a Dictionary.

Returns
The Dictionary object with field names as keys, and field values as its values.

◆ getFieldNames()

ListPtr<IString> getFieldNames ( ) const
inline

Gets a list of all Struct field names.

Returns
The list of field names.

The list of names will be of equal length to the list of values. Additionally, the name of a field at any given index corresponds to the value stored in the list of values.

◆ getFieldValues()

ListPtr<IBaseObject> getFieldValues ( ) const
inline

Gets a list of all Struct field values.

Returns
The list of field values.

The list of names will be of equal length to the list of values. Additionally, the name of a field at any given index corresponds to the value stored in the list of values.

◆ getStructType()

StructTypePtr getStructType ( ) const
inline

Gets the Struct's type.

Returns
The Struct type

◆ hasField()

Bool hasField ( const StringPtr name) const
inline

Checks whether a field with the given name exists in the Struct.

Parameters
nameThe name of the checked field.
Returns
True if the a field with name exists in the Struct; false otherwise.

◆ set()

StructBuilderPtr set ( const StringPtr name,
const BaseObjectPtr field 
) const
inline

Sets the value of a field with the given name.

Parameters
nameThe name of the queried field.
fieldThe value of the field.

◆ setFieldValues()

StructBuilderPtr setFieldValues ( const ListPtr< IBaseObject values) const
inline

Sets a list of all Struct field values.

Parameters
valuesThe list of field values.

The list of names will be of equal length to the list of values. Additionally, the name of a field at any given index corresponds to the value stored in the list of values.