File: SMObject.h

package info (click to toggle)
magnus 20060324-3
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 19,404 kB
  • ctags: 20,466
  • sloc: cpp: 130,118; ansic: 37,076; tcl: 10,970; perl: 1,109; makefile: 963; sh: 403; yacc: 372; csh: 57; awk: 33; asm: 10
file content (165 lines) | stat: -rw-r--r-- 4,908 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
// Copyright (C) 1995 The New York Group Theory Cooperative
// See magnus/doc/COPYRIGHT for the full notice.

// Contents: Declarations of class SMObject, and helper IconID
//
// Principal Author: Roger Needham
//
// Status: useable
//
// Revision History:
//
// * EP added:
//
//              static const IconID VectorOfWords;


#ifndef _SMOBJECT_H_
#define _SMOBJECT_H_


#include "List.h"
#include "FEData.h"


//---------------------------------------------------------------------------//
//----------------------------- IconID --------------------------------------//
//---------------------------------------------------------------------------//

//@rn In separate attributes wrapper?

class IconID
{
public:

  static const IconID group;
  static const IconID subgroup;
  static const IconID SetOfWords;
  static const IconID VectorOfWords;
  static const IconID elt;
  static const IconID equation;
  static const IconID systemOfEquations;
  static const IconID map;
  static const IconID homomorphism;
  static const IconID permutation;
  static const IconID enumerator_object;
  static const IconID enumerator_problem;
  static const IconID list_object;
  static const IconID problem;
  static const IconID none;
  static const IconID do_not_display;

  bool operator == ( const IconID& ) const;
  bool operator != ( const IconID& ) const;

  friend inline ostream& operator << ( ostream& ostr, const IconID& iid ) {
	 ostr << iid.theName;
	 return ostr;
  }

private:

  IconID( const char* name ) : theName( name ) { }

  const char* theName;

};


//---------------------------------------------------------------------------//
//---------------------------- SMObject -------------------------------------//
//---------------------------------------------------------------------------//


class SMObject : protected FEData
{
public:

  /////////////////////////////////////////////////////////////////////////
  //                                                                     //
  // Front End Interfacing:                                              //
  //                                                                     //
  /////////////////////////////////////////////////////////////////////////

  operator OID ( ) const { return theOid; }

  OID oid( ) const { return theOid; }

  virtual const char* typeID( ) const = 0;

  virtual const IconID iconID( ) const = 0;

  virtual void viewStructure(ostream& ostr) const = 0;

  virtual void printProperties(ostream& ostr) const = 0;

  virtual void printDefinition(ostream& ostr) const = 0;

  virtual bool displayInFE( ) const { return true; }

  bool isComputationManager( ) const { return isCM; }
  // Used by class TheObjects.


protected:

  /////////////////////////////////////////////////////////////////////////
  //                                                                     //
  // Constructors:                                                       //
  //                                                                     //
  /////////////////////////////////////////////////////////////////////////

  SMObject(bool is_cm = false);

  virtual ~SMObject( ) { }

  /////////////////////////////////////////////////////////////////////////
  //                                                                     //
  // `Public' Members Touched by Friends:                                //
  //                                                                     //
  /////////////////////////////////////////////////////////////////////////

  friend class SessionManager;
  friend class TheObjects;
  friend class Ctor;
  friend class SubordinateBase;
  friend class SMFPGroup;
  friend class SMSubgroup;
  friend class SMWord;
  friend class SMMap;
  friend class SMMagnusBreakdown;
  friend class UnboundedSupervisor;
  friend class CheckinMessage;

  virtual void readMessage(istream&) = 0;
  // Used by class SessionManager.
  //@rn return bool, so overriding fns can use default too?


private:

  ListOf<OID> getDependents( ) { return dependents; }
  // Used by class TheObjects for deleting dependents.

  void addDependent(OID oid) { dependents.append( oid ); }
  // Used by classes Ctor, SubordinateBase, SMFPGroup, UnboundedSupervisor.

  SMObject(const SMObject&);
  // Hidden, not to be implemented.

  /////////////////////////////////////////////////////////////////////////
  //                                                                     //
  // Data Members:                                                       //
  //                                                                     //
  /////////////////////////////////////////////////////////////////////////

  const OID theOid;

  bool isCM;
  // Cheap way to distinguish ComputationManagers from AlgebraicObjects.

  ListOf<OID> dependents;
  // The oids of the SMObjects which depend on this one.
};

#endif