Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members | Related Pages | Examples

VOS::LocalMetaObject Class Reference

A local object which is extensible using the MetaObject architechture. More...

#include <vos/corelibs/vos/localmetaobject.hh>

Inheritance diagram for VOS::LocalMetaObject:

VOS::MetaObject VOS::LocalVobject VOS::Vobject VOS::VobjectImplementation VOS::RefCounted VOS::Vobject VOS::ObjectExciseListener VOS::RefCounted VOS::LocalSite VOS::LocalSocketSite List of all members.

Public Member Functions


Detailed Description

A local object which is extensible using the MetaObject architechture.

Generally this will be used as the root of a MetaObject extension tree, because it inherits from LocalVobject and VobjectImplementation all the relevant Vobject data structures.

Definition at line 44 of file localmetaobject.hh.


Constructor & Destructor Documentation

VOS::LocalMetaObject::LocalMetaObject const string &  name,
LocalSite localsite,
VobjectAccessControl ac
 

virtual VOS::LocalMetaObject::~LocalMetaObject  )  [virtual]
 


Member Function Documentation

virtual void VOS::LocalMetaObject::acquire  )  [virtual]
 

Note that this means you have a handle on the entire logical object!

Reimplemented from VOS::MetaObject.

virtual void VOS::LocalMetaObject::addChildListener ChildChangeListener cl,
bool  notifyImmediately = true
[virtual]
 

Adds some object callback to be notified when the child list changes.

The child listener will immediately be issued a notifyChildInserted() for each child.

Parameters:
cl The listener object. If this object is also a RefCounted object, reference counting will be done correctly.
notifyImmediately if true, notify listener immediately (before returning). otherwise defer until a future update

Reimplemented from VOS::MetaObject.

virtual void VOS::LocalMetaObject::addFlag const string &  flag  )  [virtual]
 

Add a flag string.

Mainly useful for doing tree walks, when you want to mark an object as already having been touched.

Parameters:
flag the flag string

Implements VOS::Vobject.

virtual void VOS::LocalMetaObject::addParentListener ParentChangeListener pl,
bool  notifyImmediately = true
[virtual]
 

Adds some object callback to be notified when the parent set changes.

Parameters:
pl the listener object notifyImmediately if true, notify listener immediately (before returning). otherwise defer until a future update If this object is also a RefCounted object, reference counting will be done correctly.

Reimplemented from VOS::MetaObject.

virtual void VOS::LocalMetaObject::addType const string &  s,
MetaObject add_requester
[virtual]
 

virtual void VOS::LocalMetaObject::addType const string &  s  )  [virtual]
 

Adds a new type to this object's type set.

This only changes the stored set of type name strings and does not necessarily affect the actual code behind the object. See the Local Site class for information about extending the actual functionality of an existing meta objects.

Parameters:
s the type string

Reimplemented from VOS::LocalVobject.

virtual void VOS::LocalMetaObject::addTypeListener TypeChangeListener tl,
bool  notifyImmediately = true
[virtual]
 

Adds some object callback to be notified when the type set changes.

Parameters:
tl the listener object.
notifyImmediately if true, notify listener immediately (before returning). otherwise defer until a future update If this object is also a RefCounted object, reference counting will be done correctly.

Reimplemented from VOS::MetaObject.

virtual bool VOS::LocalMetaObject::checkFlag const string &  flag  )  [virtual]
 

Check the flag string.

Parameters:
flag the flag string
Returns:
whether the flag string is set

Implements VOS::Vobject.

virtual void VOS::LocalMetaObject::excise  )  [virtual]
 

Note:
Important: this is delegated to the top object, and means you want the entire logical Vobject to go away! If called on an object with no superobject, it calls doExcise() on its type handlers. Type implementation specific cleanup code (such as calling excise on certain children no longer needed) should override doExcise().

Reimplemented from VOS::MetaObject.

virtual Vobject::ParentChildRelation& VOS::LocalMetaObject::findChild const string &  path  )  throw (NoSuchObjectError, AccessControlError, RemoteError) [virtual]
 

Find a child.

This searchs for a single parent-child relation in the immediate child list of this object. It is distinguished from findObject in that it returns the full parent-child relation structure, and that it only accepts two forms of input: the child name, or the #position. See setChild() for more information about the possible numerical values of positions.

Parameters:
path either the child name or #position
Returns:
the ParentChildRelation structure representing the relation of this parent and the requested child. NOTE YOU MUST CALL release() WHEN DONE OR USE A rREF() BLOCK
Exceptions:
NoSuchObjectError if the path is illegal
AccessControlError if the site reported the user is not allowed that information

Implements VOS::Vobject.

virtual Vobject& VOS::LocalMetaObject::findObject const string &  path  )  throw (NoSuchSiteError, NoSuchObjectError, URL::BadURLError, AccessControlError, RemoteError) [virtual]
 

Searchs and returns some object similarly to findObjectFromRoot().

However, if the path does not start with the string "vop://" the path will be intepreted as relative to this object. For example, "foo/bar" will find the first child object named "foo" of this object, then the first child named "bar" of the "foo" object and return it. If there is a leading slash, the path is relative to the object's site, so "/foo/bar" does not necessarily mean the same thing. Note that there should never be a slash at the end, so "foo/" is NOT a legal path. Finally, instead of using child names, one may use "\#position", starting from zero. So "\#0" refers to the first child of this object, "\#1" to the second etc. Obviously if the number in #position is larger than the number of children, an exception will be raised. See setChild() for more information about the possible numerical values of positions.

Parameters:
path the path to the object we want to find
Returns:
the object, if found. NOTE YOU MUST CALL release() WHEN DONE OR USE A rREF() BLOCK
Exceptions:
NoSuchSiteError The DNS lookup for the site failed, the site is not listening on the expected port, or the site otherwise could not be connected to (only thrown if there is a site specified in the path.)
NoSuchObjectError if that object path does not exist on the site
URL::BadURLError if there is a syntax error in the supplied URL
AccessControlError if the site reported that the user is not allowed that information

Implements VOS::Vobject.

Referenced by VOS::LocalSocketSite::sendMessage().

virtual Vobject::ParentChildRelation& VOS::LocalMetaObject::findParent Vobject parent  )  throw (NoSuchObjectError, AccessControlError) [virtual]
 

Find a parent.

This tests to see if the supplied Vobject is marked as a parent of this Vobject.

Parameters:
parent the parent object
Returns:
the parent-child relation. NOTE YOU MUST CALL release() WHEN DONE OR USE A rREF() BLOCK
Exceptions:
NoSuchObjectError if the object is NOT a parent
AccessControlError if the site reported the user is not allowed that information

Reimplemented from VOS::MetaObject.

virtual const ChildList& VOS::LocalMetaObject::getChildren  )  throw (AccessControlError, RemoteError) [virtual]
 

Get the set of parent-child relationships in which this object is the parent.

Returns:
a set of parent-child relations
Warning:
You should always assign the results of getChildren to a variable. Do NOT do this:
       for(Vobject::ChildList::const_iterator i = v->getChildren().begin();
            i != v->getChildren().end(); i++) {
            ...
       }
Instead, you should do this:
       const ChildList& cl = v->getChildren();
       for(Vobject::ChildList::const_iterator i = cl.begin(); i != cl.end(); i++) {
            ...
       }
The reason for this is that if vobj is remote, each call to getChildren() may trigger a remote call. In addition to being inefficient, this will wipe and replace the child list you are in the midst of using, which will probably invalidate the iterator and cause your program to crash.

Reimplemented from VOS::MetaObject.

virtual int VOS::LocalMetaObject::getCount  )  [virtual]
 

Note that this counts for the entire logical object!

Reimplemented from VOS::MetaObject.

virtual const string& VOS::LocalMetaObject::getName  )  [virtual]
 

Get the site name of this object.

Returns:
the name string

Reimplemented from VOS::MetaObject.

virtual const ParentSet& VOS::LocalMetaObject::getParents  )  throw (AccessControlError) [virtual]
 

Get the set of parent-child relationships in which this object is the child.

Returns:
a set of parent-child relations

Reimplemented from VOS::MetaObject.

virtual Site& VOS::LocalMetaObject::getSite  )  [virtual]
 

Get the site this object resides on.

Returns:
the site object. NOTE YOU MUST CALL release() WHEN DONE OR USE A rREF() BLOCK

Reimplemented from VOS::MetaObject.

Reimplemented in VOS::LocalSite.

virtual const TypeSet& VOS::LocalMetaObject::getTypes  )  throw (AccessControlError) [virtual]
 

Return a set of type names for the types supported by this object.

Returns:
the set of type names

Reimplemented from VOS::MetaObject.

virtual const URL& VOS::LocalMetaObject::getURL  )  [virtual]
 

Get the URL path (in the form "vop://site/name").

Returns:
the URL

Reimplemented from VOS::MetaObject.

Referenced by VOS::RemoteVobject::initFields(), and VOS::AsyncConnect::operator()().

virtual bool VOS::LocalMetaObject::hasMessageAvailable  )  [virtual]
 

Returns if the object has a message available to be dequeued by receiveMessage().

Returns:
True if receiveMessage will succeed, false if receiveMessage will throw an exception.

Reimplemented from VOS::MetaObject.

virtual bool VOS::LocalMetaObject::hasUpdateMessageAvailable  )  [virtual]
 

Returns if the object has a message available to be dequeued by receiveUpdateMessage().

Returns:
True if receiveMessage() will succeed, false if receiveMessage will throw an exception.

Reimplemented from VOS::MetaObject.

virtual void VOS::LocalMetaObject::insertChild int  position,
const string &  contextual_name,
Vobject child
throw (AccessControlError, RemoteError) [virtual]
 

Insert a child at some position with a new object.

If the position is positive, the object is inserted such that it now occupies that position, and all objects starting from the previous occupant of that position onward are moved up one. If the position in negative, the object is similarly inserted so that it now occupies that position. For example, position -1 will append the object to the end of the list, position -2 will insert the object in the second-to-last position, etc. See setChild() for more information on positions.

Parameters:
position the position
contextual_name This is the name, specific to this parent-child relation, used for refering to this object by path.
child the child object, in question
Exceptions:
AccessControl if this object (when it is remote) doesn't approve of this action.

Reimplemented from VOS::LocalVobject.

Reimplemented in VOS::LocalSite.

virtual bool VOS::LocalMetaObject::isLocal  )  [virtual]
 

Return true if this object is local, false if not.

Returns:
whether it is local

Reimplemented from VOS::MetaObject.

virtual bool VOS::LocalMetaObject::isRemote  )  [virtual]
 

Return true if this object is remote, false if not.

Returns:
whether it is remote

Reimplemented from VOS::MetaObject.

virtual Message* VOS::LocalMetaObject::receiveMessage  )  throw (MessageQueueEmptyError) [virtual]
 

Gets the next message the object has received.

Exceptions:
MessageQueueEmptyError If the message queue is empty. This may be the case if there are no messages available or if the user has set DoNotQueueMsgs to true in VobjectImplementation.
Returns:
the message. NOTE YOU MUST CALL release() WHEN DONE OR USE vRef!

Reimplemented from VOS::MetaObject.

virtual Message* VOS::LocalMetaObject::receiveUpdateMessage  )  throw (MessageQueueEmptyError) [virtual]
 

Gets the next update message the object has received.

Exceptions:
MessageQueueEmptyError If the message queue is empty. This may be the case if there are no messages available or if the user has set DoNotQueueUpdateMsgs to true in VobjectImplementation.
Returns:
the message. NOTE YOU MUST CALL release() WHEN DONE OR USE vRef!

Reimplemented from VOS::MetaObject.

virtual void VOS::LocalMetaObject::release  )  [virtual]
 

Note that this means you are releasing the entire logical object!

Reimplemented from VOS::MetaObject.

Referenced by VOS::RemoteSite::~RemoteSite().

virtual void VOS::LocalMetaObject::removeChild int  position  )  throw (AccessControlError, RemoteError) [virtual]
 

Remove the child at some position.

See setChild() for more information on positions.

Parameters:
position the position
Exceptions:
AccessControl if this object (when it is remote) doesn't approve of this action.

Reimplemented from VOS::LocalVobject.

Reimplemented in VOS::LocalSite.

virtual void VOS::LocalMetaObject::removeChildListener ChildChangeListener cl  )  [virtual]
 

Removes an existing object callback, previously added with addChildListener().

Parameters:
cl the listener object If this object is also a RefCounted object, reference counting will be done correctly.

Reimplemented from VOS::MetaObject.

virtual void VOS::LocalMetaObject::removeFlag const string &  flag  )  [virtual]
 

Remove a flag string.

Parameters:
flag the flag string

Implements VOS::Vobject.

virtual void VOS::LocalMetaObject::removeParentListener ParentChangeListener pl  )  [virtual]
 

Removes an existing object callback, previously added with addParentListener().

Parameters:
pl the listener object If this object is also a RefCounted object, reference counting will be done correctly.

Reimplemented from VOS::MetaObject.

virtual void VOS::LocalMetaObject::removeTypeListener TypeChangeListener tl  )  [virtual]
 

Removes an existing object callback, previously added with addTypeListener().

Parameters:
tl the listener object If this object is also a RefCounted object, reference counting will be done correctly.

Reimplemented from VOS::MetaObject.

virtual void VOS::LocalMetaObject::saveState MessageBlock output,
set< string > &  types,
bool  portable
[virtual]
 

Create a message block which, when run, will recreate any non-VOS state related to this vobject (such as property values).

In other words, it should not emit anything related to parent-child relationships, but is rather is a hook for other arbitrary state information, encoded as messages.

Note:
Save-state routines ought to work for saving remote objects as well, based on available state. Also, only the method and the message fields themselves should be used. "To", "from", "nonce" and others will be ignored.
Parameters:
output messages should be appended to this message block
types the type set that should be output for this vobject
portable If true, generate a "portable" state. This means that all the data required to restore state should be embedded in the message. If false, fully recreating the state may rely on external resources such as files or databases.

Implements VOS::Vobject.

virtual void VOS::LocalMetaObject::sendMessage MessageBlock m  )  [virtual]
 

Sends a block of messages to the object.

This may trigger immediate processing of the message if the object is local.

Parameters:
m A pointer to the message which is being sent. Its reference count will be increased as necssary.

Reimplemented from VOS::LocalVobject.

Reimplemented in VOS::LocalSite.

virtual void VOS::LocalMetaObject::sendMessage Message m  )  [virtual]
 

Sends a message to the object.

This may trigger immediate processing of the message if the object is local.

Parameters:
m A pointer to the message which is being sent. Its reference count will be increased as necssary.

Reimplemented from VOS::LocalVobject.

Reimplemented in VOS::LocalSite, and VOS::LocalSocketSite.

virtual void VOS::LocalMetaObject::sendUpdateMessage Message m  )  [virtual]
 

Gets the next message the update object has received.

Update messages are special in that they consist of messages sent from remote sites to update changes to our local cache.

Parameters:
m A pointer to the message which is being sent. Its reference count will be increased as necssary.

Reimplemented from VOS::MetaObject.

virtual void VOS::LocalMetaObject::setChild int  position,
const string &  contextual_name,
Vobject child
throw (AccessControlError, RemoteError) [virtual]
 

Replace a child at some position with a new object.

Note:
On positions: if a position is zero or positive, its meaning is as you would expect, expressing the offset into an array of children. However, if the position is negative, it expresses the offset from the end of the list. This means for a list of length n, -1 is the last item in the list (equal to position position n - 1) and -n is the first item (equal to positive position 0). This position notation is used in setChild() findObject(), findObjectFromRoot(), insertChild(), and removeChild(); it should also be available with any methods who make use of the previously-mentioned methods.
Parameters:
position the position
contextual_name This is the name, specific to this parent-child relation, used for refering to this object by path.
child the child object, in question
Exceptions:
AccessControl if this object (when it is remote) doesn't approve of this action.

Reimplemented from VOS::LocalVobject.

Reimplemented in VOS::LocalSite.


The documentation for this class was generated from the following file:
Generated on Tue Aug 12 03:56:03 2003 for Interreality Project - VOS by doxygen 1.3.2