00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef TECPLOT_TOOLBOX_ARGLIST_H
00012 #define TECPLOT_TOOLBOX_ARGLIST_H
00013
00014 #if defined MSWIN
00015 #pragma once
00016 #endif
00017
00018 #include <string>
00019 #include <list>
00020 #include <vector>
00021 #include "tptoolbox.h"
00022 #include "OutOfMemoryException.h"
00023 #include "ToolboxFwd.h"
00024
00025 namespace tecplot
00026 {
00027 namespace toolbox
00028 {
00029
00034 class TPTOOLBOX_DLLAPI ArgList
00035 {
00036 public:
00043 ArgList();
00044 virtual ~ArgList();
00045
00058 virtual bool appendArbParam(std::string name,
00059 ArbParam_t value);
00060
00073 virtual bool appendArbParamPtr(std::string name,
00074 ArbParam_t* value);
00075
00088 virtual bool appendArray(std::string name,
00089 const void* data);
00090
00103 template<typename T>
00104 bool appendArray(std::string name,
00105 const T* data);
00106
00119 template<typename T>
00120 bool appendArray(std::string name,
00121 const std::vector<T>& data);
00122
00135 virtual bool appendDouble(std::string name,
00136 double value);
00137
00150 virtual bool appendDoublePtr(std::string name,
00151 double* value);
00152
00165 virtual bool appendFunction(std::string name,
00166 const void* function);
00167
00180 virtual bool appendInt(std::string name,
00181 LgIndex_t value);
00182
00195 virtual bool appendSet(std::string name,
00196 const Set& set);
00197
00210 virtual bool appendString(std::string name,
00211 std::string value);
00212
00225 virtual bool appendStringList(std::string name,
00226 const StringList& stringList);
00227
00234 virtual void clear();
00235
00243 virtual ArgList_pa getRef() const;
00244 private:
00245 ArgList_pa m_argList;
00246 std::list<StringList> m_stringLists;
00247 std::list<Set> m_sets;
00248
00249 ArgList(const ArgList&);
00250 ArgList& operator=(const ArgList&);
00251 };
00252
00255 template<typename T>
00256 bool ArgList::appendArray(std::string name,
00257 const T* data)
00258 {
00259 REQUIRE(!name.empty());
00260 REQUIRE(VALID_REF(data));
00261
00262 Boolean_t result = TecUtilArgListAppendArray(m_argList,
00263 name.c_str(),
00264 reinterpret_cast<const void*>(data));
00265
00266 ENSURE(VALID_BOOLEAN(result));
00267 return (result == TRUE);
00268 }
00269
00272 template<typename T>
00273 bool ArgList::appendArray(std::string name,
00274 const std::vector<T>& data)
00275 {
00276 REQUIRE(!name.empty());
00277 REQUIRE(!data.empty());
00278
00279 Boolean_t result = TecUtilArgListAppendArray(m_argList,
00280 name.c_str(),
00281 reinterpret_cast<const void*>(&data[0]));
00282
00283 ENSURE(VALID_BOOLEAN(result));
00284 return (result == TRUE);
00285 }
00286
00287 }
00288 }
00289
00290 #endif