FRIBParallelanalysis  1.0
FrameworkforMPIParalleldataanalysisatFRIB
TCLInterpreterObject.h
1 /*
2  This software is Copyright by the Board of Trustees of Michigan
3  State University (c) Copyright 2014.
4 
5  You may use this software under the terms of the GNU public license
6  (GPL). The terms of this license are described at:
7 
8  http://www.gnu.org/licenses/gpl.txt
9 
10  Authors:
11  Ron Fox
12  Jeromy Tompkins
13  NSCL
14  Michigan State University
15  East Lansing, MI 48824-1321
16 */
17 
18 // CTCLInterpreterObject.h:
19 //
20 // This file defines the CTCLInterpreterObject class.
21 //
22 // Author:
23 // Ron Fox
24 // NSCL
25 // Michigan State University
26 // East Lansing, MI 48824-1321
27 // mailto:fox@nscl.msu.edu
28 //
29 // Copyright 1999 NSCL, All Rights Reserved.
30 //
32 
33 #ifndef TCLINTERPRETEROBJECT_H //Required for current class
34 #define TCLINTERPRETEROBJECT_H
35 
36 #ifndef TCLPLUSTYPES_H
37 #include <libtclplusdatatypes.h>
38 #endif
39 
40 
41 #include <tcl.h>
42 #include <assert.h>
43 
44 class CTCLInterpreter; // Forward reference to interpreter.
45 
47 {
48 
49  CTCLInterpreter* m_pInterpreter;
50 
51 public:
52  //Default constructor
53 
54  CTCLInterpreterObject () : m_pInterpreter(0)
55  { }
56  virtual ~CTCLInterpreterObject ( ) { } //Destructor
57 
58 
59 
61  m_pInterpreter(pInterp)
62  { }
63 
64  //Copy constructor
65 
66  CTCLInterpreterObject (const CTCLInterpreterObject& aCTCLInterpreterObject )
67  {
68  m_pInterpreter = aCTCLInterpreterObject.m_pInterpreter;
69  }
70 
71  //Operator= Assignment Operator
72 
73  CTCLInterpreterObject& operator=
74  (const CTCLInterpreterObject& aCTCLInterpreterObject)
75  {
76  if (this == &aCTCLInterpreterObject) return *this;
77  m_pInterpreter = aCTCLInterpreterObject.m_pInterpreter;
78  return *this;
79  }
80 
81  //Operator== Equality Operator
82 
83  int operator== (const CTCLInterpreterObject& aCTCLInterpreterObject) const
84  {
85  return (m_pInterpreter == aCTCLInterpreterObject.m_pInterpreter);
86 
87  }
88 
89  //Get accessor function for 1:1 association
90  CTCLInterpreter* getInterpreter() const
91  {
92  return m_pInterpreter;
93  }
94 
95 
96  CTCLInterpreter* Bind (CTCLInterpreter& rBinding){
97  return Bind(&rBinding);
98  }
99  CTCLInterpreter* Bind (CTCLInterpreter* pBinding);
100  //
101  // protected utility:
102  //
103 protected:
104  CTCLInterpreter* AssertIfNotBound() {
105  CTCLInterpreter* pInterp = getInterpreter();
106  assert(pInterp != TCLPLUS::kpNULL);
107  return pInterp;
108  }
109 
110 };
111 
112 #endif
Definition: TCLInterpreterObject.h:46
Definition: TCLInterpreter.h:59