1 
2 //#**************************************************************
3 //#
4 //# filename:             variable.cpp
5 //#
6 //# autor:                Gerstmayr Johannes
7 //#
8 //# generated:            29.11.98
9 //# last change:          29.11.98
10 //# description:          implementation class for variables
11 //# remarks:
12 //#
13 //# Copyright (c) 2003-2013 Johannes Gerstmayr, Linz Center of Mechatronics GmbH, Austrian
14 //# Center of Competence in Mechatronics GmbH, Institute of Technical Mechanics at the
15 //# Johannes Kepler Universitaet Linz, Austria. All rights reserved.
16 //#
17 //# This file is part of HotInt.
18 //# HotInt is free software: you can redistribute it and/or modify it under the terms of
19 //# the HOTINT license. See folder 'licenses' for more details.
20 //#
21 //# bug reports are welcome!!!
22 //# WWW:		www.hotint.org
23 //# email:	bug_reports@hotint.org or support@hotint.org
24 //#**************************************************************
25 
26 #include "mbs_interface.h"
27 #include "parser.h"
28 
29 
30 //+++++++++++++++++++++  CVariable +++++++++++++++++++++
31 
CVariable()32 CVariable::CVariable()
33 {
34   mathObj = NULL;
35 };
36 
CVariable(const mystr & namei)37 CVariable::CVariable(const mystr& namei)
38 {
39   mathObj = NULL;
40   name = namei;
41 }
42 
Name()43 mystr CVariable::Name()
44 {
45   return name;
46 }
47 
SetName(mystr namei)48 void CVariable::SetName(mystr namei)
49 {
50 	name = namei;
51 }
52 
Assign(CMathObj * mathObji)53 void CVariable::Assign(CMathObj* mathObji)
54 {
55   if (mathObj != NULL)
56   {
57     //mathObj->DeleteMO();
58     //delete mathObj;
59   }
60   mathObj = mathObji;
61 }
62 
MathObj()63 CMathObj* CVariable::MathObj()
64 {
65   return mathObj;
66 }
67 
SetMathObj(CMathObj * mathObj)68 void CVariable::SetMathObj(CMathObj* mathObj)
69 {
70   this->mathObj = mathObj;
71 }
72 
73 //+++++++++++++++++++++  CVariableList +++++++++++++++++++++
74 
CVariableList()75 CVariableList::CVariableList() : CParseObjList()
76 {
77 }
78 
Object(mystr str)79 CVariable* CVariableList::Object(mystr str)
80 {
81   int i = IsObject(str);
82   if (i)
83   {
84     return (CVariable*)Get(i);
85   } else
86   {
87     CVariable* var = new CVariable(str);
88     Add(var);
89     return var;
90   }
91 }
92 
GetVariable(int i)93 CVariable* CVariableList::GetVariable(int i)
94 {
95 	return (CVariable*)Get(i);
96 }
97 
98 
99