Adding and Removing List Elements

ostc_ObjectList::addObject()

virtual ostc_Object * addObject() ;

Creates an ostc_Object and adds it to the end of the list. Returns a pointer to the new object.

ostc_ObjectList::deleteObject()

virtual void deleteObject(ostc_Object*&) ;

If called by the Server, removes the specified object from the list, and sets the argument to 0. Repositions the cursor at the element immediately before the removed element. If there is no previous element, the cursor is rendered invalid. This function has no effect if called by the thin client.

ostc_OID

This class is an abstract base class. If you want to use OIDs, you must derive a class from ostc_OID and implement the functions listed below.

ostc_OID::stringify()

virtual oscs_ConstString stringify() const;

Returns a string that serves as a unique identifier.

ostc_OID::match

virtual oscs_Bool match(ostc_OID*) const;

Returns 1 if the OIDs designate the same object; returns 0 otherwise.

Example

class MyOID : public ostc_OID {
public
      MyOID(int id){_id = id;}
      int getID() {return id;}
      char * stringify() {
            sprintf(string_version, "%ld", id); return string_version;
      }
private:
      int id;
      char string_version[10];
};

On the Server (format() function):

MyOID oid{10);
ostc_Object * obj  = objlist->addObject();
obj->setValue("object", &oid); 

On the client:

ostc_OID * oid = obj->getObjectValue("object");
MyOID oid(atoi(oid->stringify()));

Global Functions

To create a Component Server plug-in, you must implement the following global functions:

ostc_MissingFunc is thrown if you fail to implement one of these functions.

A source or header file for your Server plug-in must include the following declaration of the global functions:

extern "C" { 

#ifdef WIN32
__declspec( dllexport )  void ostcInitialize(void);
__declspec( dllexport )  void ostcConnect(ostc_ServerSession *);
__declspec( dllexport )  void ostcDisconnect(void);
#else
void ostcInitialize(void);
void ostcConnect(ostc_ServerSession *);
void ostcDisconnect(void);
#endif
}

This use of _declspec is required for Windows platforms.



[previous] [next]