ICP  1
variant_utils.h
Go to the documentation of this file.
1 #ifndef VARIANT_UTILS
2 #define VARIANT_UTILS
3 
4 class COMexception : public std::runtime_error
5 {
6 public:
7  explicit COMexception(const std::string& what_arg) : std::runtime_error(what_arg) { }
8 // explicit COMexception(const char* what_arg) : std::runtime_error(what_arg) { }
9 // explicit COMexception(const COMexception& c) : std::runtime_error(c) { }
10 // explicit COMexception() : std::runtime_error() { }
11 // explicit COMexception(const char* message, HRESULT hr) : std::runtime_error(message + lookupHRESULT(hr)) { }
12  explicit COMexception(const std::string& message, HRESULT hr) : std::runtime_error(com_message(message, hr)) { }
13 private:
14  static std::string com_message(const std::string& message, HRESULT hr);
15 };
16 
17 
18 int allocateArrayVariant(VARIANT* v, VARTYPE v_type, int* dims_array, int ndims);
19 
20 int accessArrayVariant(VARIANT* v, float** values);
21 int accessArrayVariant(VARIANT* v, double** values);
22 int accessArrayVariant(VARIANT* v, long** values);
23 int accessArrayVariant(VARIANT* v, VARIANT** values);
24 int accessArrayVariant(VARIANT* v, BSTR** values);
25 
26 int unaccessArrayVariant(VARIANT* v);
27 
28 int arrayVariantLength(VARIANT* v);
29 int arrayVariantDimensions(VARIANT* v, int dims_array[], int& ndims);
30 
31 template <typename T>
32 int makeVariantFromArray(VARIANT* v, const T* the_array, int n);
33 
34 template <typename T>
35 int makeVariantFromArray(VARIANT* v, const std::vector<T>& the_array);
36 
37 
38 #endif /* VARIANT_UTILS */
int allocateArrayVariant(VARIANT *v, VARTYPE v_type, int *dims_array, int ndims)
COMexception(const std::string &what_arg)
Definition: variant_utils.h:7
COMexception(const std::string &message, HRESULT hr)
Definition: variant_utils.h:12
static int accessArrayVariant(VARIANT *v, void **values, VARTYPE vt)
int arrayVariantLength(VARIANT *v)
int arrayVariantDimensions(VARIANT *v, int dims_array[], int &ndims)
int unaccessArrayVariant(VARIANT *v)
static std::string com_message(const std::string &message, HRESULT hr)
int makeVariantFromArray(VARIANT *v, const std::vector< T > &the_array)