Class IORegistry

Index Home MAE > MAE Architecture > MAE Data Types > Class Index > Class IORegistry

Summary
Public Methods
IORegistry(id)
IORegistry(name)
IORegistry(data)
void clear()
inline bool valid() const
inline DbRecNum getId() const
inline const string& getName() const
inline const string& getType() const
inline bool isDirectory() const
inline bool inFileSystem() const
inline const string& getSpoke() const
inline const string& getPath() const
inline const HashArray& getParams() const
inline const string& getParamsData(key) const
inline long getParamsInt(key) const
inline int getState() const
string getStateLabel() const
string get(key) const
inline IORegistry& setName(newname)
inline IORegistry& setType(newtype)
inline IORegistry& setSpoke(newspoke)
inline IORegistry& setPath(newpath)
inline IORegistry& setParams(newparams)
inline IORegistry& setParamsData(key, value)
inline IORegistry& setParamsData(key, value)
inline IORegistry& setState(newstate)
IORegistry& set(data)
bool set(key, value)
static DbRecList find(criteria, sortby)
static DbRecList find(criteria, sortby)
static DbRecList findAll()
HashArray toHashArray(forDB) const
inline XMLData toXML(forDB) const
DbRecNum save()
bool deleteRecord()
static DbRecNum append(values)
DbRecNum append()
static inline IORegistry cache(id)
Protected Methods
bool load(id)
Private Properties
Private Methods
static bool initdb()
See Also

#include <IORegistry.h >

Summary

Class to represent each registered MAE I/O resource.

Public Methods

IORegistry(id)

DbRecNum id

db table record id; 0 for empty record

Default value: 0


Constructor with optional db table record id.

IORegistry(name)

const string& name

the resource name to fetch


Constructor with unique resource name.

IORegistry(data)

const HashArray& data

key-value pairs with property names as keys


Constructor with input from HashArray.

void clear()

Reset/Clear the contents of this instance

inline bool valid() const

Determine if this instance has valid data or no.

Return value: true if valid; flase if not valid

inline DbRecNum getId() const

Get the value of Table record id.

Return value: the value of id

inline const string& getName() const

Get the value of Name of the resource.

Return value: the value of name

inline const string& getType() const

Get the value of Type of resource (file, socket, etc.).

Return value: the value of type

inline bool isDirectory() const

Return true if the type is a directory

Return value: true if it's a directory, false otherwise

inline bool inFileSystem() const

Return true if the resource is in the MAE filesystem.

Return value: true if it's in the filesystem, false otherwise

inline const string& getSpoke() const

Get the value of Name of spoke for resource.

Return value: the value of spoke

inline const string& getPath() const

Get the value of Path to resource.

Return value: the value of path

inline const HashArray& getParams() const

Get the value of Parameters to accessing the resource.

Return value: the value of params

inline const string& getParamsData(key) const

const string& key


inline long getParamsInt(key) const

const string& key


inline int getState() const

Get the value of State of the resource (IOR_OPEN, IOR_UNKNOWN, IOR_CLOSED).

Return value: the value of state

string getStateLabel() const

Get the label of State of the resource (open, unknown, closed).

Return value: the label of state

string get(key) const

string key

the propery name to get (case insensitive)


Given a IORegistry single property name (key), return its value as a string.

Return value: the string equivalent of the property

inline IORegistry& setName(newname)

const string& newname

the new value for name


Set the value of Name of the resource.

Return value: the updated instance of IORegistry

inline IORegistry& setType(newtype)

const string& newtype

the new value for type


Set the value of Type of resource (file, socket, etc.).

Return value: the updated instance of IORegistry

inline IORegistry& setSpoke(newspoke)

const string& newspoke

the new value for spoke


Set the value of Name of spoke for resource.

Return value: the updated instance of IORegistry

inline IORegistry& setPath(newpath)

const string& newpath

the new value for path


Set the value of Path to resource.

Return value: the updated instance of IORegistry

inline IORegistry& setParams(newparams)

const HashArray& newparams

the new value for params


Set the value of Parameters to accessing the resource.

Return value: the updated instance of IORegistry

inline IORegistry& setParamsData(key, value)

const string& key

the key to set

const string& value

the value to set for the key (as string)


Set a key-value pair in params.

Return value: the updated instance of IORegistry

inline IORegistry& setParamsData(key, value)

const string& key

the key to set

long value

the value to set for the key (as long)


Set a key-value pair in params.

Return value: the updated instance of IORegistry

inline IORegistry& setState(newstate)

int newstate

the new value for state


Set the value of State of the resource (IOR_OPEN, IOR_UNKNOWN, IOR_CLOSED).

Return value: the updated instance of IORegistry

IORegistry& set(data)

const HashArray& data


Given a set of IORegistry properties in key-value pairs, initialize this instance with them.

This is complementary to toHashArray().

Return value: the initialized instance of IORegistry

bool set(key, value)

string key

the propery name to set (case insensitive)

const string& value

a string equivalent to assign (it will be converted)


Given a IORegistry single property name (key) and a string value, assign the value to the property.

Return value: true upon success, false on failure (like invalid property name)

static DbRecList find(criteria, sortby)

const HashArray& criteria

key/value (field/value) pairs to find

const string& sortby

sort the resulting list by this field name

Default value: ""


Given field/value criteria, find matching record ids.

Return value: list of IORegistry record ids matching the criteria

static DbRecList find(criteria, sortby)

const string& criteria

an expression of fields, comparators, parenthesis and logic ops

const string& sortby

sort the resulting list by this field name

Default value: ""


Given criteria expression, find matching record ids.

Return value: list of IORegistry record ids matching the criteria

static DbRecList findAll()

Find all IORegistry record ids.

Return value: list of all IORegistry record ids

HashArray toHashArray(forDB) const

bool forDB

false to include Id; true to exclude Id, which is handy for sending to Datastore

Default value: false


Convert this instance's data into a HashArray.

This is the complement of set()

Return value: a HashArray of instance's properties

inline XMLData toXML(forDB) const

bool forDB

false to include Id; true to exclude Id, which is handy for sending to Datastore

Default value: false


Convert this instance's data to XML.

Return value: a XMLData of instance's properties

DbRecNum save()

Save this record to the Datastore.

If the data has not changed, it is not saved.

Return value: the Id upon success, 0 on failure

bool deleteRecord()

Delete the record from the Datastore.

Return value: true if successfully deleted; false on error (like id==0 or DB error)

static DbRecNum append(values)

const HashArray& values

key/value pairs for field assignments


Add a new record to the Datastore.

If the Id field is set, it will be used; if 0, a new Id will be assigned.

Return value: the new record's record Id

DbRecNum append()

Add a new record to the Datastore.

If the Id is set, it will be used; if 0, a new Id will be assigned.

Return value: the new record's record Id

static inline IORegistry cache(id)

DbRecNum id

the id of the record to fetch


Method needed by the Cache class to fetch a record from the datastore.

Return value: the fetched record; check valid() for success of operation

Protected Methods

bool load(id)

DbRecNum id

the id of the record to load


Load data from the Datastore with the provided Id.

Return value: true upon success; false upon faliure

Private Properties

DbRecNum id

Table record id

string name

Name of the resource

string type

Type of resource (file, socket, etc.)

string spoke

Name of spoke for resource

string path

Path to resource

HashArray params

Parameters to accessing the resource

int state

State of the resource (IOR_OPEN, IOR_UNKNOWN, IOR_CLOSED)

bool changed

Flag: true if any data in this instance has changed

static Datastore db

Our connection to DB table data


Private Methods

static bool initdb()

Make sure we're connected to our table in the Datastore

Return value: true upon success, false upon failure

See Also

IORegistry database table