All Classes Namespaces Functions Typedefs Enumerations
octeval.h
1 #ifndef _MBXMLUTILS_OCTEVAL_H_
2 #define _MBXMLUTILS_OCTEVAL_H_
3 
4 #include "eval.h"
5 #include <boost/scoped_ptr.hpp>
6 #include <boost/shared_ptr.hpp>
7 #include <boost/make_shared.hpp>
8 
9 class octave_value;
10 class octave_value_list;
11 class octave_function;
12 
13 namespace XERCES_CPP_NAMESPACE { class DOMElement; }
14 
15 namespace MBXMLUtils {
16 
17 boost::shared_ptr<octave_value> C(const boost::shared_ptr<void> &value);
18 
19 boost::shared_ptr<void> C(const octave_value &value);
20 
21 class OctEval;
22 
24 class OctEval : public Eval {
25  friend class Eval;
26 
27  protected:
29  OctEval(std::vector<boost::filesystem::path> *dependencies_=NULL);
30 
31  public:
33  ~OctEval();
34 
36  static std::string getNameStatic() { return "octave"; }
37  std::string getName() const { return getNameStatic(); }
38 
43  void addImport(const std::string &code, const xercesc::DOMElement *e, bool deprecated=false);
44 
46  bool valueIsOfType(const boost::shared_ptr<void> &value, ValueType type) const;
47 
49  std::map<boost::filesystem::path, std::pair<boost::filesystem::path, bool> >& requiredFiles() const;
50 
51  virtual bool useOneBasedIndexes() { return true; }
52 
53  protected:
54 
56  // (in the later case the dtor is not called but octave must be uninitialized before exit)
57  void deinitOctave();
58 
60  virtual boost::shared_ptr<void> fullStringToValue(const std::string &str, const xercesc::DOMElement *e=NULL) const;
61 
63  void* getSwigThis(const boost::shared_ptr<void> &value) const;
64 
66  std::string getSwigType(const boost::shared_ptr<void> &value) const;
67 
68  boost::shared_ptr<void> createSwigByTypeName(const std::string &typeName) const;
69 
70  // initial path
71  static std::string initialPath;
72  static std::string pathSep;
73 
74  static int initCount;
75 
76  static octave_value_list fevalThrow(octave_function *func, const octave_value_list &arg, int n=0,
77  const std::string &msg=std::string());
78 
79  virtual boost::shared_ptr<void> callFunction(const std::string &name, const std::vector<boost::shared_ptr<void> >& args) const;
80 
81  virtual double cast_double (const boost::shared_ptr<void> &value) const;
82  virtual std::vector<double> cast_vector_double (const boost::shared_ptr<void> &value) const;
83  virtual std::vector<std::vector<double> > cast_vector_vector_double(const boost::shared_ptr<void> &value) const;
84  virtual std::string cast_string (const boost::shared_ptr<void> &value) const;
85 
86  virtual boost::shared_ptr<void> create_double (const double& v) const;
87  virtual boost::shared_ptr<void> create_vector_double (const std::vector<double>& v) const;
88  virtual boost::shared_ptr<void> create_vector_vector_double(const std::vector<std::vector<double> >& v) const;
89  virtual boost::shared_ptr<void> create_string (const std::string& v) const;
90 };
91 
92 } // end namespace MBXMLUtils
93 
94 #endif
Definition: eval.h:77
void addImport(const std::string &code, const xercesc::DOMElement *e, bool deprecated=false)
Definition: octeval.cc:302
Definition: octeval.h:24
void deinitOctave()
This function deinitialized octave. It is used in the dtor and before exceptions in the ctor are thro...
Definition: octeval.cc:288
bool valueIsOfType(const boost::shared_ptr< void > &value, ValueType type) const
get the type of value
Definition: octeval.cc:426
OctEval(std::vector< boost::filesystem::path > *dependencies_=NULL)
Constructor.
Definition: octeval.cc:203
virtual bool useOneBasedIndexes()
Return true if the evaluator used one based indexes or false if zero based indexes are used...
Definition: octeval.h:51
void * getSwigThis(const boost::shared_ptr< void > &value) const
get the SWIG pointer of this value.
Definition: octeval.cc:477
boost::shared_ptr< void > createSwigByTypeName(const std::string &typeName) const
create a SWIG object of name typeName.
Definition: octeval.cc:192
std::ostream & msg(MsgType type)
std::map< boost::filesystem::path, std::pair< boost::filesystem::path, bool > > & requiredFiles() const
return a list of all required files of octave (excluding dependent files of libraries) ...
Definition: octeval.cc:496
~OctEval()
Destructor.
Definition: octeval.cc:284
virtual boost::shared_ptr< void > callFunction(const std::string &name, const std::vector< boost::shared_ptr< void > > &args) const
Definition: octeval.cc:551
virtual boost::shared_ptr< void > fullStringToValue(const std::string &str, const xercesc::DOMElement *e=NULL) const
evaluate str fully and return result as an octave variable
Definition: octeval.cc:343
std::string getSwigType(const boost::shared_ptr< void > &value) const
get the SWIG class name of this value.
Definition: octeval.cc:487
std::string getName() const
Get the type of this evaluator.
Definition: octeval.h:37
static std::string getNameStatic()
Get the name of this evaluator.
Definition: octeval.h:36
ValueType
Definition: eval.h:83

Impressum / Disclaimer / Datenschutz Generated by doxygen 1.8.5 Valid HTML