FlightGear next
FGParameter.h
Go to the documentation of this file.
1/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2
3Header: FGParameter.h
4Author: Jon Berndt
5Date started: August 25 2004
6
7 ------------- Copyright (C) 2001 Jon S. Berndt (jon@jsbsim.org) -------------
8
9 This program is free software; you can redistribute it and/or modify it under
10 the terms of the GNU Lesser General Public License as published by the Free
11 Software Foundation; either version 2 of the License, or (at your option) any
12 later version.
13
14 This program is distributed in the hope that it will be useful, but WITHOUT
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
17 details.
18
19 You should have received a copy of the GNU Lesser General Public License along
20 with this program; if not, write to the Free Software Foundation, Inc., 59
21 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22
23 Further information about the GNU Lesser General Public License can also be
24 found on the world wide web at http://www.gnu.org.
25
26%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
27SENTRY
28%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
29
30#ifndef FGPARAMETER_H
31#define FGPARAMETER_H
32
33/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
34INCLUDES
35%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
36
37#include <string>
38#include "simgear/structure/SGSharedPtr.hxx"
39
40/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
41FORWARD DECLARATIONS
42%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
43
44namespace JSBSim {
45
46/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
47CLASS DOCUMENTATION
48%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
49
53
54/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
55DECLARATION: FGParameter
56%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
57
58class FGParameter : public SGReferenced
59{
60public:
61 virtual ~FGParameter(void) {};
62 virtual double GetValue(void) const = 0;
63 virtual std::string GetName(void) const = 0;
64 virtual bool IsConstant(void) const { return false; }
65
66 // SGPropertyNode impersonation.
67 double getDoubleValue(void) const { return GetValue(); }
68};
69
70typedef SGSharedPtr<FGParameter> FGParameter_ptr;
71
72inline double operator*(double v, const FGParameter_ptr& p) {
73 return v*p->GetValue();
74}
75
76inline double operator*(const FGParameter_ptr& p, double v) {
77 return p->GetValue()*v;
78}
79
80} // namespace JSBSim
81
82#endif
#define p(x)
Represents various types of parameters.
Definition FGParameter.h:59
virtual double GetValue(void) const =0
virtual ~FGParameter(void)
Definition FGParameter.h:61
virtual std::string GetName(void) const =0
virtual bool IsConstant(void) const
Definition FGParameter.h:64
double getDoubleValue(void) const
Definition FGParameter.h:67
FGColumnVector3 operator*(double scalar, const FGColumnVector3 &A)
Scalar multiplication.
SGSharedPtr< FGParameter > FGParameter_ptr
Definition FGParameter.h:70