home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / include / ObjectTcl-1.1 / otcl / OtclObjMgr.H < prev    next >
Encoding:
C/C++ Source or Header  |  1995-06-29  |  5.1 KB  |  137 lines

  1. #ifndef OTCL_OBJ_MGR_H
  2. #define OTCL_OBJ_MGR_H
  3.  
  4. /*  _ __ ___ _
  5.  * | |\ /  /| |  $Id: OtclObjMgr.H,v 1.5 1995/06/16 13:04:07 deans Exp $
  6.  * | | /  / | |  Copyright (C) 1995 IXI Limited.
  7.  * |_|/__/_\|_|  IXI Limited, Cambridge, England.
  8.  *
  9.  * Component   : OtclObjMgr.H
  10.  *
  11.  * Author      : Dean Sheehan (deans@x.co.uk)
  12.  *  
  13.  * Description : Header file for OtclObjMgr class and OtclObjMgrCmd class that
  14.  *               mapps object references to Tcl commands.
  15.  *
  16.  * License     :
  17.             Object Tcl License & Copyright
  18.             -----------------------------
  19.  
  20. IXI ObjectT cl software, both binary and source (hereafter, Software) is copyrighted by IXI Limited (IXI), and ownership remains with IXI. 
  21.  
  22. IXI grants you (herafter, Licensee) a license to use the Software for academic, research and internal business purposes only, without a fee. Licensee may distribute the binary and source code (if required) to third parties provided that the copyright notice and this statement appears on all copies and that no charge is associated with such copies. 
  23.  
  24. Licensee may make derivative works. However, if Licensee distributes any derivative work based on or derived from the Software, then Licensee will (1) notify IXI regarding its distribution of the derivative work, and (2) clearly notify users that such derivative work is a modified version and not the original IXI Object Tcl distributed by IXI. IXI strongly recommends that Licensee provide IXI the right to incorporate such modifications into future releases of the Software under these license terms. 
  25.  
  26. Any Licensee wishing to make commercial use of the Software should contact IXI, to negotiate an appropriate license for such commercial use. Commercial use includes (1) integration of all or part of the source code into a product for sale or license by or on behalf of Licensee to third parties, or (2) distribution of the binary code or source code to third parties that need it to utilize a commercial product sold or licensed by or on behalf of Licensee. 
  27.  
  28. IXI MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THIS SOFTWARE FOR ANY PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY. IXI SHALL NOT BE LIABLE FOR ANY DAMAGES WHATSOEVER SUFFERED BY THE USERS OF THIS SOFTWARE. 
  29.  
  30. Copyright (C) 1995, IXI Limited 
  31.  
  32. By using or copying this Software, Licensee agrees to abide by the copyright law and all other applicable laws of England and the U.S., including, but not limited to, export control laws, and the terms of this license. IXI shall have the right to terminate this license immediately by written notice upon Licensee's breach of, or non-compliance with, any of its terms. Licensee may be held legally responsible for any copyright infringement that is caused or encouraged by Licensee's failure to abide by the terms of this license. 
  33.  
  34. Comments and questions are welcome and can be sent to
  35. otcl@x.co.uk 
  36.  
  37. For more information on copyright and licensing issues, contact: 
  38. Legal Department, IXI Limited, Vision Park, Cambridge CB4 4ZR,
  39. ENGLAND. 
  40.  
  41.  *
  42.  */
  43.  
  44. // Tcl Includes
  45.  #include <tcl.h>
  46.  
  47. // Forward Declarations
  48. class OtclObject;
  49.  
  50. // Definitions
  51. #define SYMBOLIC_REFERENCE_SIZE 64
  52.  
  53. class OtclObjMgr
  54. {
  55. public:    // Destructor
  56.  
  57.    OtclObjMgr ();
  58.  
  59. public:   // Public Instance Methods
  60.  
  61.    // Returns a NULL terminate string containing the symbolic handle to the
  62.    // object for use within Tcl as a command.
  63.    // The char * returned is an internal attribute that
  64.    // is valid until the next call to OtclObjMgr.
  65.    virtual char *manageObject (OtclObject *, Tcl_Interp *) = 0;
  66.  
  67. #ifdef OTCL_DP
  68.    // Same as above accept the symbolic reference is already known
  69.    virtual int manageObject (OtclObject *, char *symRef, Tcl_Interp *) = 0;
  70. #endif
  71.  
  72.    // Returns the OtclObject unManaged or NULL if not a managed object
  73.    virtual OtclObject *unManageObject(char *symbolicRef, Tcl_Interp *) = 0;
  74.  
  75.    virtual OtclObject *dereference (char *symbolicRef, Tcl_Interp *,
  76.                                     int &returnCode) = 0;
  77.  
  78.    void setObjectReferenceSuffix (char *suffix);
  79.  
  80. protected: // Constructor
  81.  
  82.    // Protected so that OtclObjMgr is abstract!
  83.    virtual ~OtclObjMgr ();
  84.  
  85.    char *suffix;
  86.  
  87. protected:  // Protected Instance Attributes
  88.  
  89.    char symRef[SYMBOLIC_REFERENCE_SIZE];
  90.  
  91. };
  92.  
  93. // To manage OtclObjects using the Tcl command table.
  94. class OtclObjMgrCmd : public OtclObjMgr
  95. {
  96. public:   // Constructor & Destructor
  97.  
  98.    OtclObjMgrCmd ();
  99.  
  100.    virtual ~OtclObjMgrCmd ();
  101.  
  102. public:  // Public Instance Methods
  103.  
  104.    char *manageObject (OtclObject *, Tcl_Interp *);
  105.  
  106. #ifdef OTCL_DP
  107.    int manageObject (OtclObject *, char *symRef, Tcl_Interp *);
  108. #endif
  109.  
  110.    OtclObject *unManageObject(char *symbolicRef, Tcl_Interp *);
  111.  
  112.    OtclObject *dereference (char *symbolicRef, Tcl_Interp *, int &);
  113.  
  114.    int obj (OtclObject *, Tcl_Interp *, int argc, char *argv[]);
  115.  
  116. public:  // Public Class Methods
  117.  
  118.    static int objCmd (ClientData, Tcl_Interp *, int argc, char *argv[]);
  119.  
  120. private: // Private Class
  121.  
  122.    class MgrAndObjPair
  123.    {
  124.    public:
  125.       MgrAndObjPair (OtclObjMgrCmd *m, OtclObject *o)
  126.       {
  127.          otclmc = m;
  128.          otclo = o;
  129.       }
  130.       OtclObjMgrCmd *otclmc;
  131.       OtclObject *otclo;
  132.    };
  133.  
  134. };
  135.  
  136. #endif // OTCL_OBJ_MGR_H
  137.