SheafSystem  0.0.0.0
sheaf::primitive_value Class Reference

Abstract object wrapper for an instance of a primitive type. More...

#include <primitive_value.h>

Public Member Functions

 primitive_value ()
 Default constructor. More...
 
 primitive_value (const primitive_value &xother)
 Copy constructor. More...
 
 primitive_value (primitive_type xid)
 Creates a new primitive value of the type associated with xid and default value. More...
 
 primitive_value (pod_index_type xid, void *xvalue_ptr)
 Creates a new primitive value of the type associated with xid and value pointed to by xvalue_ptr. More...
 
 primitive_value (const void *x)
 Conversion from pointer; creates a new primitive value of type VOID_STAR with value x. More...
 
 primitive_value (const char *x)
 Conversion from C string; creates a new primitive value of type C_STRING with value x. More...
 
 primitive_value (const std::string &x)
 Conversion from string; creates a new primitive value of type C_STRING with value x. More...
 
 primitive_value (const scoped_index &x)
 Conversion from scoped_index; creates a new primitive value of type POD_INDEX_TYPE with value x. More...
 
 primitive_value (const namespace_relative_member_index &x)
 Conversion from namespace_relative_member_index; creates a new primitive value of type NAMESPACE_RELATIVE_MEMBER_INDEX with value x. More...
 
 primitive_value (const namespace_relative_subposet_index &x)
 Conversion from namespace_relative_subposet_index; creates a new primitive value of type NAMESPACE_RELATIVE_SUBPOSET_INDEX with value x. More...
 
 primitive_value (const bool &x)
 Conversion from bool; creates a new primitive value of type BOOL with value x. More...
 
 primitive_value (const char &x)
 Conversion from char; creates a new primitive value of type CHAR with value x. More...
 
 primitive_value (const signed char &x)
 Conversion from signed char; creates a new primitive value of type SIGNED_CHAR with value x. More...
 
 primitive_value (const short int &x)
 Conversion from short int; creates a new primitive value of type SHORT_INT with value x. More...
 
 primitive_value (const int &x)
 Conversion from int; creates a new primitive value of type INT with value x. More...
 
 primitive_value (const long int &x)
 Conversion from long int; creates a new primitive value of type LONG_INT with value x. More...
 
 primitive_value (const long long int &x)
 Conversion from long long int; creates a new primitive value of type LONG_LONG_INT with value x. More...
 
 primitive_value (const unsigned char &x)
 Conversion from unsigned char; creates a new primitive value of type UNSIGNED_CHAR with value x. More...
 
 primitive_value (const unsigned short int &x)
 Conversion from unsigned short int; creates a new primitive value of type UNSIGNED_SHORT_INT with value x. More...
 
 primitive_value (const unsigned int &x)
 Conversion from unsigned int; creates a new primitive value of type UNSIGNED_INT with value x. More...
 
 primitive_value (const unsigned long int &x)
 Conversion from unsigned long int; creates a new primitive value of type UNSIGNED_LONG_INT with value x. More...
 
 primitive_value (const unsigned long long int &x)
 Conversion from unsigned long long int; creates a new primitive value of type UNSIGNED_LONG_LONG_INT with value x. More...
 
 primitive_value (const float &x)
 Conversion from float; creates a new primitive value of type FLOAT with value x. More...
 
 primitive_value (const double &x)
 Conversion from double; creates a new primitive value of type DOUBLE with value x. More...
 
 primitive_value (const long double &x)
 Conversion from long double; creates a new primitive value of type LONG_DOUBLE with value x. More...
 
 primitive_value (const namespace_relative_member_index_pod_type &x)
 Conversion from namespace_relative_member_index_pod_type; creates a new primitive value of type NAMESPACE_RELATIVE_MEMBER_INDEX_POD_TYPE with value x. More...
 
 primitive_value (const namespace_relative_subposet_index_pod_type &x)
 Conversion from namespace_relative_subposet_index_pod_type; creates a new primitive value of type NAMESPACE_RELATIVE_SUBPOSET_INDEX_POD_TYPE with value x. More...
 
primitive_valueoperator= (const primitive_value &x)
 Copy assignment. More...
 
primitive_valueoperator= (void *x)
 Assignment from pointer. More...
 
primitive_valueoperator= (const void *x)
 Assignment from pointer. More...
 
primitive_valueoperator= (char *x)
 Assignment from C string. More...
 
primitive_valueoperator= (const char *x)
 Assignment from C string. More...
 
template<typename T >
primitive_valueoperator= (const T &x)
 Assignment from primitive of type T. More...
 
 operator bool () const
 Conversion to bool. More...
 
 operator char () const
 Conversion to char. More...
 
 operator signed char () const
 Conversion to signed char. More...
 
 operator short int () const
 Conversion to short int. More...
 
 operator int () const
 Conversion to int. More...
 
 operator long int () const
 Conversion to long int. More...
 
 operator long long int () const
 Conversion to long long int. More...
 
 operator unsigned char () const
 Conversion to unsigned char. More...
 
 operator unsigned short int () const
 Conversion to unsigned short int. More...
 
 operator unsigned int () const
 Conversion to unsigned int. More...
 
 operator unsigned long int () const
 Conversion to unsigned long int. More...
 
 operator unsigned long long int () const
 Conversion to unsigned long long int. More...
 
 operator float () const
 Conversion to float. More...
 
 operator double () const
 Conversion to double. More...
 
 operator long double () const
 Conversion to long double. More...
 
 operator void * () const
 Conversion to void*. More...
 
 operator char * () const
 Conversion to char*. More...
 
 operator namespace_relative_member_index_pod_type () const
 Conversion to namespace_relative_member_index_pod_type. More...
 
 operator namespace_relative_subposet_index_pod_type () const
 Conversion to namespace_relative_subposet_index_pod_type. More...
 
 ~primitive_value ()
 Destructor. More...
 
primitive_buffer_typevalue ()
 The value of this. More...
 
const primitive_buffer_typevalue () const
 The value of this, const version. More...
 
primitive_typeid ()
 Type id of the primitive type. More...
 
const primitive_typeid () const
 Type id of the primitive type, const version. More...
 
std::string to_string () const
 Converts this to a string (for stream insertion). More...
 
bool from_string (const std::string &x)
 Converts this from a string (from stream extraction); returns true if operation successful, false otherwise. More...
 
template<typename T >
sheaf::primitive_valueoperator= (const T &x)
 
template<>
SHEAF_DLL_SPEC sheaf::primitive_valueoperator= (const std::string &x)
 
template<>
SHEAF_DLL_SPEC sheaf::primitive_valueoperator= (const scoped_index &x)
 
template<>
SHEAF_DLL_SPEC sheaf::primitive_valueoperator= (const namespace_relative_member_index &x)
 
template<>
SHEAF_DLL_SPEC sheaf::primitive_valueoperator= (const namespace_relative_subposet_index &x)
 
template<>
SHEAF_DLL_SPEC sheaf::primitive_valueoperator= (const poset_path &x)
 

Static Public Member Functions

static const primitive_valueprototype (pod_index_type xid)
 The prototype for the primitive value of the type associated with xid. More...
 

Friends

SHEAF_DLL_SPEC bool operator== (const primitive_value &xpv1, const primitive_value &xpv2)
 Comparison of xpv1 to xpv2. More...
 

Detailed Description

Abstract object wrapper for an instance of a primitive type.

Definition at line 53 of file primitive_value.h.

Constructor & Destructor Documentation

◆ primitive_value() [1/27]

sheaf::primitive_value::primitive_value ( )

Default constructor.

Definition at line 239 of file primitive_value.cc.

References sheaf::primitive_traits< T >::default_value(), and sheaf::primitive_traits< T >::id().

Referenced by primitive_value(), and prototype().

◆ primitive_value() [2/27]

sheaf::primitive_value::primitive_value ( const primitive_value xother)

Copy constructor.

Definition at line 247 of file primitive_value.cc.

References primitive_value().

◆ primitive_value() [3/27]

sheaf::primitive_value::primitive_value ( primitive_type  xid)

Creates a new primitive value of the type associated with xid and default value.

Precondition
  • is_primitive_index(xid)
Postcondition
  • -unexecutable( "value() == primitive_attributes::default_value(xid)" )

Definition at line 254 of file primitive_value.cc.

References sheaf::is_primitive_index(), and primitive_value().

◆ primitive_value() [4/27]

sheaf::primitive_value::primitive_value ( pod_index_type  xid,
void *  xvalue_ptr 
)

Creates a new primitive value of the type associated with xid and value pointed to by xvalue_ptr.

Precondition
  • is_primitive_index(xid)
  • xvalue_ptr != 0
Postcondition
  • -unexecutable( "value() == *reinterpret_cast<primitive_buffer_type*>(xvalue_ptr)" )

Definition at line 284 of file primitive_value.cc.

References sheaf::is_primitive_index(), and primitive_value().

◆ primitive_value() [5/27]

sheaf::primitive_value::primitive_value ( const void *  x)

Conversion from pointer; creates a new primitive value of type VOID_STAR with value x.

Postcondition

Definition at line 312 of file primitive_value.cc.

References primitive_value().

◆ primitive_value() [6/27]

sheaf::primitive_value::primitive_value ( const char *  x)

Conversion from C string; creates a new primitive value of type C_STRING with value x.

Postcondition

Definition at line 331 of file primitive_value.cc.

References primitive_value().

◆ primitive_value() [7/27]

sheaf::primitive_value::primitive_value ( const std::string &  x)

Conversion from string; creates a new primitive value of type C_STRING with value x.

Postcondition

Definition at line 352 of file primitive_value.cc.

References primitive_value().

◆ primitive_value() [8/27]

sheaf::primitive_value::primitive_value ( const scoped_index x)

Conversion from scoped_index; creates a new primitive value of type POD_INDEX_TYPE with value x.

Postcondition

Definition at line 371 of file primitive_value.cc.

References sheaf::scoped_index::pod(), and primitive_value().

◆ primitive_value() [9/27]

sheaf::primitive_value::primitive_value ( const namespace_relative_member_index x)

Conversion from namespace_relative_member_index; creates a new primitive value of type NAMESPACE_RELATIVE_MEMBER_INDEX with value x.

Postcondition

Definition at line 390 of file primitive_value.cc.

References sheaf::namespace_relative_member_index::pod(), and primitive_value().

◆ primitive_value() [10/27]

sheaf::primitive_value::primitive_value ( const namespace_relative_subposet_index x)

Conversion from namespace_relative_subposet_index; creates a new primitive value of type NAMESPACE_RELATIVE_SUBPOSET_INDEX with value x.

Postcondition

Definition at line 409 of file primitive_value.cc.

References sheaf::namespace_relative_subposet_index::pod(), and primitive_value().

◆ primitive_value() [11/27]

sheaf::primitive_value::primitive_value ( const bool &  x)

Conversion from bool; creates a new primitive value of type BOOL with value x.

Postcondition

Definition at line 428 of file primitive_value.cc.

References primitive_value().

◆ primitive_value() [12/27]

sheaf::primitive_value::primitive_value ( const char &  x)

Conversion from char; creates a new primitive value of type CHAR with value x.

Postcondition

Definition at line 447 of file primitive_value.cc.

References primitive_value().

◆ primitive_value() [13/27]

sheaf::primitive_value::primitive_value ( const signed char &  x)

Conversion from signed char; creates a new primitive value of type SIGNED_CHAR with value x.

Postcondition

Definition at line 466 of file primitive_value.cc.

References primitive_value().

◆ primitive_value() [14/27]

sheaf::primitive_value::primitive_value ( const short int &  x)

Conversion from short int; creates a new primitive value of type SHORT_INT with value x.

Postcondition

Definition at line 485 of file primitive_value.cc.

References primitive_value().

◆ primitive_value() [15/27]

sheaf::primitive_value::primitive_value ( const int &  x)

Conversion from int; creates a new primitive value of type INT with value x.

Postcondition

Definition at line 504 of file primitive_value.cc.

References primitive_value().

◆ primitive_value() [16/27]

sheaf::primitive_value::primitive_value ( const long int &  x)

Conversion from long int; creates a new primitive value of type LONG_INT with value x.

Postcondition

Definition at line 523 of file primitive_value.cc.

References primitive_value().

◆ primitive_value() [17/27]

sheaf::primitive_value::primitive_value ( const long long int &  x)

Conversion from long long int; creates a new primitive value of type LONG_LONG_INT with value x.

Postcondition

Definition at line 542 of file primitive_value.cc.

References primitive_value().

◆ primitive_value() [18/27]

sheaf::primitive_value::primitive_value ( const unsigned char &  x)

Conversion from unsigned char; creates a new primitive value of type UNSIGNED_CHAR with value x.

Postcondition

Definition at line 561 of file primitive_value.cc.

References primitive_value().

◆ primitive_value() [19/27]

sheaf::primitive_value::primitive_value ( const unsigned short int &  x)

Conversion from unsigned short int; creates a new primitive value of type UNSIGNED_SHORT_INT with value x.

Postcondition

Definition at line 580 of file primitive_value.cc.

References primitive_value().

◆ primitive_value() [20/27]

sheaf::primitive_value::primitive_value ( const unsigned int &  x)

Conversion from unsigned int; creates a new primitive value of type UNSIGNED_INT with value x.

Postcondition

Definition at line 599 of file primitive_value.cc.

References primitive_value().

◆ primitive_value() [21/27]

sheaf::primitive_value::primitive_value ( const unsigned long int &  x)

Conversion from unsigned long int; creates a new primitive value of type UNSIGNED_LONG_INT with value x.

Postcondition

Definition at line 618 of file primitive_value.cc.

References primitive_value().

◆ primitive_value() [22/27]

sheaf::primitive_value::primitive_value ( const unsigned long long int &  x)

Conversion from unsigned long long int; creates a new primitive value of type UNSIGNED_LONG_LONG_INT with value x.

Postcondition

Definition at line 637 of file primitive_value.cc.

References primitive_value().

◆ primitive_value() [23/27]

sheaf::primitive_value::primitive_value ( const float &  x)

Conversion from float; creates a new primitive value of type FLOAT with value x.

Postcondition

Definition at line 656 of file primitive_value.cc.

References primitive_value().

◆ primitive_value() [24/27]

sheaf::primitive_value::primitive_value ( const double &  x)

Conversion from double; creates a new primitive value of type DOUBLE with value x.

Postcondition

Definition at line 675 of file primitive_value.cc.

References primitive_value().

◆ primitive_value() [25/27]

sheaf::primitive_value::primitive_value ( const long double &  x)

Conversion from long double; creates a new primitive value of type LONG_DOUBLE with value x.

Postcondition

Definition at line 694 of file primitive_value.cc.

References primitive_value().

◆ primitive_value() [26/27]

sheaf::primitive_value::primitive_value ( const namespace_relative_member_index_pod_type x)

Conversion from namespace_relative_member_index_pod_type; creates a new primitive value of type NAMESPACE_RELATIVE_MEMBER_INDEX_POD_TYPE with value x.

Postcondition

Definition at line 713 of file primitive_value.cc.

References primitive_value().

◆ primitive_value() [27/27]

sheaf::primitive_value::primitive_value ( const namespace_relative_subposet_index_pod_type x)

Conversion from namespace_relative_subposet_index_pod_type; creates a new primitive value of type NAMESPACE_RELATIVE_SUBPOSET_INDEX_POD_TYPE with value x.

Postcondition

Definition at line 732 of file primitive_value.cc.

References operator=().

◆ ~primitive_value()

sheaf::primitive_value::~primitive_value ( )

Destructor.

Definition at line 1095 of file primitive_value.cc.

References to_string().

Referenced by operator namespace_relative_subposet_index_pod_type().

Member Function Documentation

◆ from_string()

bool sheaf::primitive_value::from_string ( const std::string &  x)

Converts this from a string (from stream extraction); returns true if operation successful, false otherwise.

Definition at line 1118 of file primitive_value.cc.

References sheaf::auto_block< T, un_block_initialization_policy< T > >::ct(), sheaf::primitive_traits< T >::default_value(), sheaf::operator==(), and sheaf::auto_block< T, un_block_initialization_policy< T > >::set_ct().

Referenced by sheaf::operator>>(), and to_string().

◆ id() [1/2]

◆ id() [2/2]

const primitive_type& sheaf::primitive_value::id ( ) const
inline

Type id of the primitive type, const version.

Definition at line 414 of file primitive_value.h.

◆ operator bool()

sheaf::primitive_value::operator bool ( ) const

Conversion to bool.

Definition at line 977 of file primitive_value.cc.

◆ operator char()

sheaf::primitive_value::operator char ( ) const

Conversion to char.

Definition at line 983 of file primitive_value.cc.

◆ operator char *()

sheaf::primitive_value::operator char * ( ) const

Conversion to char*.

Definition at line 1073 of file primitive_value.cc.

◆ operator double()

sheaf::primitive_value::operator double ( ) const

Conversion to double.

Definition at line 1055 of file primitive_value.cc.

◆ operator float()

sheaf::primitive_value::operator float ( ) const

Conversion to float.

Definition at line 1049 of file primitive_value.cc.

◆ operator int()

sheaf::primitive_value::operator int ( ) const

Conversion to int.

Definition at line 1001 of file primitive_value.cc.

◆ operator long double()

sheaf::primitive_value::operator long double ( ) const

Conversion to long double.

Definition at line 1061 of file primitive_value.cc.

◆ operator long int()

sheaf::primitive_value::operator long int ( ) const

Conversion to long int.

Definition at line 1007 of file primitive_value.cc.

◆ operator long long int()

sheaf::primitive_value::operator long long int ( ) const

Conversion to long long int.

Definition at line 1013 of file primitive_value.cc.

◆ operator namespace_relative_member_index_pod_type()

sheaf::primitive_value::operator namespace_relative_member_index_pod_type ( ) const

Conversion to namespace_relative_member_index_pod_type.

Definition at line 1079 of file primitive_value.cc.

◆ operator namespace_relative_subposet_index_pod_type()

sheaf::primitive_value::operator namespace_relative_subposet_index_pod_type ( ) const

Conversion to namespace_relative_subposet_index_pod_type.

Definition at line 1085 of file primitive_value.cc.

References ~primitive_value().

◆ operator short int()

sheaf::primitive_value::operator short int ( ) const

Conversion to short int.

Definition at line 995 of file primitive_value.cc.

◆ operator signed char()

sheaf::primitive_value::operator signed char ( ) const

Conversion to signed char.

Definition at line 989 of file primitive_value.cc.

◆ operator unsigned char()

sheaf::primitive_value::operator unsigned char ( ) const

Conversion to unsigned char.

Definition at line 1019 of file primitive_value.cc.

◆ operator unsigned int()

sheaf::primitive_value::operator unsigned int ( ) const

Conversion to unsigned int.

Definition at line 1031 of file primitive_value.cc.

◆ operator unsigned long int()

sheaf::primitive_value::operator unsigned long int ( ) const

Conversion to unsigned long int.

Definition at line 1037 of file primitive_value.cc.

◆ operator unsigned long long int()

sheaf::primitive_value::operator unsigned long long int ( ) const

Conversion to unsigned long long int.

Definition at line 1043 of file primitive_value.cc.

◆ operator unsigned short int()

sheaf::primitive_value::operator unsigned short int ( ) const

Conversion to unsigned short int.

Definition at line 1025 of file primitive_value.cc.

◆ operator void *()

sheaf::primitive_value::operator void * ( ) const

Conversion to void*.

Definition at line 1067 of file primitive_value.cc.

◆ operator=() [1/6]

sheaf::primitive_value & sheaf::primitive_value::operator= ( const primitive_value x)

Copy assignment.

Definition at line 756 of file primitive_value.cc.

Referenced by operator=(), and primitive_value().

◆ operator=() [2/6]

sheaf::primitive_value & sheaf::primitive_value::operator= ( void *  x)

Assignment from pointer.

Definition at line 768 of file primitive_value.cc.

References sheaf::primitive_traits< T >::id(), and operator=().

◆ operator=() [3/6]

sheaf::primitive_value & sheaf::primitive_value::operator= ( const void *  x)

Assignment from pointer.

Definition at line 778 of file primitive_value.cc.

References sheaf::primitive_traits< T >::id(), and operator=().

◆ operator=() [4/6]

sheaf::primitive_value & sheaf::primitive_value::operator= ( char *  x)

Assignment from C string.

Definition at line 788 of file primitive_value.cc.

References sheaf::primitive_traits< T >::id(), and operator=().

◆ operator=() [5/6]

sheaf::primitive_value & sheaf::primitive_value::operator= ( const char *  x)

Assignment from C string.

Definition at line 798 of file primitive_value.cc.

References sheaf::primitive_traits< T >::id(), and operator=().

◆ operator=() [6/6]

template<typename T >
primitive_value& sheaf::primitive_value::operator= ( const T &  x)

Assignment from primitive of type T.

◆ prototype()

const sheaf::primitive_value & sheaf::primitive_value::prototype ( pod_index_type  xid)
static

The prototype for the primitive value of the type associated with xid.

Postcondition
  • static_cast<pod_index_type>(result.id()) == (is_primitive_index(xid) ? xid : static_cast<pod_index_type>(NOT_A_PRIMITIVE_TYPE))
  • -unexecutable( "result.value == default value for type associated with id" )

Definition at line 200 of file primitive_value.cc.

References id(), sheaf::is_primitive_index(), and primitive_value().

Referenced by sheaf::dof_tuple_record_set::internalize_all_dofs().

◆ to_string()

std::string sheaf::primitive_value::to_string ( ) const

Converts this to a string (for stream insertion).

Definition at line 1108 of file primitive_value.cc.

References from_string().

Referenced by sheaf::dof_tuple_record_set::internalize_all_dofs(), sheaf::poset_table_state::invariant(), sheaf::operator<<(), and ~primitive_value().

◆ value() [1/2]

◆ value() [2/2]

const primitive_buffer_type& sheaf::primitive_value::value ( ) const
inline

The value of this, const version.

Definition at line 398 of file primitive_value.h.

Friends And Related Function Documentation

◆ operator==

SHEAF_DLL_SPEC bool operator== ( const primitive_value xpv1,
const primitive_value xpv2 
)
friend

Comparison of xpv1 to xpv2.


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