MADARA  3.2.3
madara::knowledge::VariableReference Class Reference

Optimized reference to a variable within the knowledge base. More...

#include <VariableReference.h>

Public Types

using pair_ptr = KnowledgeMap::value_type *
 

Public Member Functions

 VariableReference ()=default
 Default constructor. More...
 
 VariableReference (pair_ptr entry)
 Construct from a pointer to entry in a KnowledgeMap. More...
 
void assign (pair_ptr entry)
 Refer to a different variable. More...
 
const char * get_name (void) const
 Returns the name of the variable. More...
 
KnowledgeRecordget_record_unsafe (void) const
 Returns a pointer to the variable's KnowledgeRecord Do not use this pointer unless you've locked the ThreadSafeContext it belongs to. More...
 
bool is_valid (void) const
 Checks to see if the variable reference has been initialized. More...
 
bool operator!= (const VariableReference &rhs) const
 Inequality operator. More...
 
bool operator== (const VariableReference &rhs) const
 Equality operator. More...
 

Private Attributes

pair_ptr entry_ = nullptr
 

Friends

class KnowledgeBaseImpl
 
class rcw::BaseTracker
 
class ThreadSafeContext
 
class Variables
 

Detailed Description

Optimized reference to a variable within the knowledge base.

Definition at line 36 of file VariableReference.h.

Member Typedef Documentation

using madara::knowledge::VariableReference::pair_ptr = KnowledgeMap::value_type *

Definition at line 44 of file VariableReference.h.

Constructor & Destructor Documentation

madara::knowledge::VariableReference::VariableReference ( )
default

Default constructor.

madara::knowledge::VariableReference::VariableReference ( pair_ptr  entry)
inline

Construct from a pointer to entry in a KnowledgeMap.

Definition at line 14 of file VariableReference.inl.

Member Function Documentation

void madara::knowledge::VariableReference::assign ( pair_ptr  entry)
inline

Refer to a different variable.

Definition at line 54 of file VariableReference.inl.

const char * madara::knowledge::VariableReference::get_name ( void  ) const
inline

Returns the name of the variable.

Returns nullptr if is_valid() is false.

Returns
the name of the referenced variable

Definition at line 30 of file VariableReference.inl.

KnowledgeRecord * madara::knowledge::VariableReference::get_record_unsafe ( void  ) const
inline

Returns a pointer to the variable's KnowledgeRecord Do not use this pointer unless you've locked the ThreadSafeContext it belongs to.

Returns nullptr if is_valid() is false.

Returns
the pointer to the KnowledgeRecord

Definition at line 45 of file VariableReference.inl.

bool madara::knowledge::VariableReference::is_valid ( void  ) const
inline

Checks to see if the variable reference has been initialized.

Returns
true if valid, false otherwise

Definition at line 39 of file VariableReference.inl.

bool madara::knowledge::VariableReference::operator!= ( const VariableReference rhs) const
inline

Inequality operator.

Parameters
rhsvariable reference to compare to

Definition at line 24 of file VariableReference.inl.

bool madara::knowledge::VariableReference::operator== ( const VariableReference rhs) const
inline

Equality operator.

Parameters
rhsvariable reference to compare to

Definition at line 18 of file VariableReference.inl.

Friends And Related Function Documentation

friend class KnowledgeBaseImpl
friend

Definition at line 40 of file VariableReference.h.

friend class rcw::BaseTracker
friend

Definition at line 42 of file VariableReference.h.

friend class ThreadSafeContext
friend

Definition at line 39 of file VariableReference.h.

friend class Variables
friend

Definition at line 41 of file VariableReference.h.

Member Data Documentation

pair_ptr madara::knowledge::VariableReference::entry_ = nullptr
private

Definition at line 97 of file VariableReference.h.


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