UNIVERS  15.3
UNIVERS base processing software API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Classes | Public Member Functions | Static Public Member Functions | List of all members
AnyValue Class Reference

#include <AnyValue.hpp>

Inheritance diagram for AnyValue:
SerialThis TextRepres

Public Member Functions

 AnyValue (AtomType at=INT_4, unsigned count=1, CategoryId catid=UC_NONE)
 
 AnyValue (double val, CategoryId catid=UC_NONE)
 
 AnyValue (int val, CategoryId catid=UC_NONE)
 
 AnyValue (const DomainDef &dmn, void *rec_ptr=NULL)
 
 AnyValue (const AnyValue &av)
 
AnyValueoperator= (const AnyValue &av)
 
virtual ~AnyValue ()
 
void new_def (AtomType at, unsigned count=1, CategoryId catid=UC_NONE)
 
void new_def (const AnyValue &av)
 
AtomType get_type () const
 
unsigned get_dim () const
 
CategoryId get_categ () const
 
void attach (void *val_ptr)
 
void detach ()
 
bool is_changed () const
 
void changes ()
 
void reset_changes ()
 
char get_char (unsigned i=0) const
 
Char2 get_unicode (unsigned i=0) const
 
double get_float (unsigned i=0) const
 
int get_int (unsigned i=0) const
 
 operator char () const
 
 operator float () const
 
 operator double () const
 
 operator short () const
 
 operator int () const
 
 operator long () const
 
BlobRef get_blob_ref () const
 
void get_int1 (char *val) const
 
void get_int2 (short *val) const
 
void get_int4 (int *val) const
 
void get_real4 (float *val) const
 
void get_real8 (double *val) const
 
void get_char (char *val) const
 
void get_unicode (Char2 *val) const
 
char * get_alloc_int1 () const
 
short * get_alloc_int2 () const
 
int * get_alloc_int4 () const
 
float * get_alloc_real4 () const
 
double * get_alloc_real8 () const
 
char * get_alloc_char () const
 
Char2 * get_alloc_unicode () const
 
void set_char (char val, unsigned i=0)
 
void set_unicode (Char2 val, unsigned i=0)
 
void set_float (double val, unsigned i=0)
 
void set_int (int val, unsigned i=0)
 
void set_blob_ref (BlobRef val)
 
void set_int1 (const char *val)
 
void set_int2 (const short *val)
 
void set_int4 (const int *val)
 
void set_real4 (const float *val)
 
void set_real8 (const double *val)
 
void set_char (const char *val)
 
void set_unicode (const Char2 *val)
 
virtual bool operator== (const AnyValue &av) const
 
bool operator!= (const AnyValue &av) const
 
virtual void serialize (OutputStream &ost) const
 
virtual void deserialize (InputStream &ist)
 
void definition (bool f)
 
virtual char * check_string (const char *s, int *pDim=NULL) const
 
virtual char * from_string (const char *s)
 
virtual char * to_string () const
 
bool is_empty_value () const
 
void empty_value ()
 
void print_self (FILE *stream=NULL, const char *szPre=NULL, const char *szPost=NULL) const
 
- Public Member Functions inherited from SerialThis
 SerialThis ()
 
 SerialThis (InputStream &ist)
 
- Public Member Functions inherited from TextRepres
 TextRepres ()
 
void set_enlarge_dim_mode (bool bMayEnlarge)
 
bool get_enlarge_dim_mode () const
 
 operator char * () const
 

Static Public Member Functions

static Compar compare (const AnyValue &av1, const AnyValue &av2)
 

Additional Inherited Members

- Protected Attributes inherited from TextRepres
bool bEnlargeMode
 

Detailed Description

Any type value container. Just one scalar or vector item can be represented.

Constructor & Destructor Documentation

AnyValue::AnyValue ( AtomType  at = INT_4,
unsigned  count = 1,
CategoryId  catid = UC_NONE 
)

Create default value of given type

AnyValue::AnyValue ( double  val,
CategoryId  catid = UC_NONE 
)

Create value of implicitly defined type

AnyValue::AnyValue ( const DomainDef dmn,
void *  rec_ptr = NULL 
)

Create shadow of given domain contents (auto attached in case of NULL!=rec_ptr)

AnyValue::AnyValue ( const AnyValue av)

Create a copy of the value (not a shadow!!!)

virtual AnyValue::~AnyValue ( )
virtual

Destroy the value

Member Function Documentation

void AnyValue::attach ( void *  val_ptr)

Attach memory with true value storage (use the value from it)

void AnyValue::changes ( )
inline

Set changes flag

virtual char* AnyValue::check_string ( const char *  s,
int *  pDim = NULL 
) const
virtual

Check the string for right parsing and return NULL in case of syntax error or pointer just after the last parsed character in case of success. Optional number may be returned if a dimension of parsed data may be needed.

Implements TextRepres.

static Compar AnyValue::compare ( const AnyValue av1,
const AnyValue av2 
)
static

Get the comparison result; for UNICODE and only equal/not-equal result has a meaning; for BlobRef operation compares only blob id, not contents

void AnyValue::definition ( bool  f)
inline

Turn on (by default) or off putting/getting value definition to/from the stream

virtual void AnyValue::deserialize ( InputStream ist)
virtual

Get the value from the stream with definition

Reimplemented from SerialThis.

void AnyValue::detach ( )
inline

Detach true value storage

void AnyValue::empty_value ( )

Setup default empty value

virtual char* AnyValue::from_string ( const char *  s)
virtual

Convert text string to predefined value. ERROR__BAD_SYNTAX is thrown in case of syntax error. Returns the pointer to the first character that can't be parsed.

Implements TextRepres.

CategoryId AnyValue::get_categ ( ) const
inline

Return category of the value

unsigned AnyValue::get_dim ( ) const
inline

Return dimension of the value

AtomType AnyValue::get_type ( ) const
inline

Return type of the value

bool AnyValue::is_changed ( ) const
inline

Get status of changes

bool AnyValue::is_empty_value ( ) const

Check for empty value

void AnyValue::new_def ( AtomType  at,
unsigned  count = 1,
CategoryId  catid = UC_NONE 
)

Change value definition

void AnyValue::new_def ( const AnyValue av)
inline

Change value definition

bool AnyValue::operator!= ( const AnyValue av) const

Inverted operator== ().

AnyValue& AnyValue::operator= ( const AnyValue av)

Make a copy of the value without touching the type and dim. Minimum number of items is copied from source av to target.

virtual bool AnyValue::operator== ( const AnyValue av) const
virtual

Return TRUE in case of two values are equal and FALSE otherwise.

void AnyValue::print_self ( FILE *  stream = NULL,
const char *  szPre = NULL,
const char *  szPost = NULL 
) const

Print contents to given stream adding leading and final strings. NULL means using stdout.

void AnyValue::reset_changes ( )
inline

Reset status of changes, leads to FALSE at next call to is_changed()

virtual void AnyValue::serialize ( OutputStream ost) const
virtual

Put the value to the stream with definition

Reimplemented from SerialThis.

virtual char* AnyValue::to_string ( ) const
virtual

Convert the value into text string. Dynamic string allocation takes place. Returned string must be free(). NULL means the value can't be converted to string for some reason.

Implements TextRepres.


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