MADARA  3.4.1
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 ThreadSafeContext
 
class Variables
 

Detailed Description

Optimized reference to a variable within the knowledge base.

Definition at line 32 of file VariableReference.h.

Member Typedef Documentation

◆ pair_ptr

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

Definition at line 39 of file VariableReference.h.

Constructor & Destructor Documentation

◆ VariableReference() [1/2]

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

Default constructor.

◆ VariableReference() [2/2]

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

Construct from a pointer to entry in a KnowledgeMap.

Definition at line 15 of file VariableReference.inl.

Member Function Documentation

◆ assign()

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

Refer to a different variable.

Definition at line 50 of file VariableReference.inl.

◆ get_name()

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 27 of file VariableReference.inl.

◆ get_record_unsafe()

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 41 of file VariableReference.inl.

◆ is_valid()

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 36 of file VariableReference.inl.

◆ operator!=()

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

Inequality operator.

Parameters
rhsvariable reference to compare to

Definition at line 22 of file VariableReference.inl.

◆ operator==()

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

Equality operator.

Parameters
rhsvariable reference to compare to

Definition at line 17 of file VariableReference.inl.

Friends And Related Function Documentation

◆ KnowledgeBaseImpl

friend class KnowledgeBaseImpl
friend

Definition at line 36 of file VariableReference.h.

◆ ThreadSafeContext

friend class ThreadSafeContext
friend

Definition at line 35 of file VariableReference.h.

◆ Variables

friend class Variables
friend

Definition at line 37 of file VariableReference.h.

Member Data Documentation

◆ entry_

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

Definition at line 92 of file VariableReference.h.


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