Update of /cvsroot/csp/APPLICATIONS/SimData/Include/SimData
In directory sc8-pr-cvs1:/tmp/cvs-serv12601/Include/SimData
Modified Files:
Enum.h Enum.i HashUtility.h Matrix3.h Vector3.h Vector3.inl
ns-simdata.h
Log Message:
see CHANGES.current
Index: Enum.h
===================================================================
RCS file: /cvsroot/csp/APPLICATIONS/SimData/Include/SimData/Enum.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** Enum.h 18 Mar 2003 06:41:34 -0000 1.3
--- Enum.h 20 Mar 2003 00:24:47 -0000 1.4
***************
*** 36,42 ****
#include <cstdio>
#include <iostream>
#include <SimData/BaseType.h>
- #include <SimData/HashUtility.h>
--- 36,42 ----
#include <cstdio>
#include <iostream>
+ #include <map>
#include <SimData/BaseType.h>
***************
*** 110,113 ****
--- 110,114 ----
public:
Enum();
+ Enum(const Enum &);
Enum(const Enumeration& parent, int idx=0);
Enum(const Enumeration& parent, const std::string &s);
***************
*** 150,153 ****
--- 151,155 ----
*/
class Enumeration {
+ typedef std::map<std::string, int> string_map;
string_map _map;
std::vector<Enum> _enums;
***************
*** 156,159 ****
--- 158,162 ----
public:
explicit Enumeration(const char* items);
+ ~Enumeration();
const std::vector<Enum> each() const;
const std::vector<std::string> eachString() const;
***************
*** 177,183 ****
bool __contains__(int i) const;
bool __contains__(const std::string& i) const;
! const Enum& __getitem__(int n) const;
! const Enum& __getitem__(const std::string& s) const;
! const Enum& __getattr_c__(const std::string& s) const;
std::string asString() const { return "<simdata::Enumeration>"; }
--- 180,186 ----
bool __contains__(int i) const;
bool __contains__(const std::string& i) const;
! const Enum __getitem__(int n) const;
! const Enum __getitem__(const std::string& s) const;
! const Enum __getattr_c__(const std::string& s) const;
std::string asString() const { return "<simdata::Enumeration>"; }
***************
*** 191,195 ****
def __getattr__(*args):
self, name = args
! if name in ["this", "thisown", "__str__"]:
return _swig_getattr(self, Enumeration, name)
return apply(_cSimData.Enumeration___getattr_c__,args)
--- 194,198 ----
def __getattr__(*args):
self, name = args
! if name.startswith('__') or name in ("this", "thisown"):
return _swig_getattr(self, Enumeration, name)
return apply(_cSimData.Enumeration___getattr_c__,args)
Index: Enum.i
===================================================================
RCS file: /cvsroot/csp/APPLICATIONS/SimData/Include/SimData/Enum.i,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Enum.i 28 Jan 2003 23:26:05 -0000 1.2
--- Enum.i 20 Mar 2003 00:24:47 -0000 1.3
***************
*** 7,10 ****
--- 7,11 ----
%include "std_vector.i"
+ %include "SimData/ns-simdata.h"
%template(vEnum) std::vector<SIMDATA(Enum)>;
***************
*** 17,27 ****
//%import "SimData/Pack.i"
! %ignore eqstring;
! %ignore hashstring;
! %ignore string_map;
#define TRY try { $action }
#define CATCH(a, b) \
catch (a& e) {\
SWIG_exception(b, const_cast<char*>(e.getError().c_str()));\
}
--- 18,29 ----
//%import "SimData/Pack.i"
! //%ignore eqstring;
! //%ignore hashstring;
! //%ignore string_map;
#define TRY try { $action }
#define CATCH(a, b) \
catch (a& e) {\
+ std::cout << "EXCEPT\n"; \
SWIG_exception(b, const_cast<char*>(e.getError().c_str()));\
}
***************
*** 35,48 ****
CATCH(SIMDATA(EnumError), SWIG_RuntimeError)
}
- /*
- %exception Enumeration {
- TRY
- CATCH(EnumTypeError, SWIG_TypeError)
- CATCH(EnumIndexError, SWIG_IndexError)
- CATCH(EnumError, SWIG_RuntimeError)
- }
- */
-
- %include "SimData/ns-simdata.h"
%rename(__repr__) SIMDATA(Enum)::asString() const;
--- 37,40 ----
Index: HashUtility.h
===================================================================
RCS file: /cvsroot/csp/APPLICATIONS/SimData/Include/SimData/HashUtility.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** HashUtility.h 18 Mar 2003 10:04:01 -0000 1.6
--- HashUtility.h 20 Mar 2003 00:24:47 -0000 1.7
***************
*** 183,199 ****
#endif
- /*
- struct equ8 {
- bool operator()(u8 i1, u8 i2) const {
- return (i1 == i2);
- }
- };
-
- struct hashu8 {
- u8 operator()(u8 i) const {
- return i;
- }
- };
- */
/*
--- 183,186 ----
***************
*** 224,228 ****
#endif
-
class Object;
class ObjectProxyBase;
--- 211,214 ----
***************
*** 235,244 ****
typedef HASH_MAPS<hasht, Object*, hasht_hash, hasht_eq>::Type cache_map;
typedef HASH_MAPS<hasht, ObjectProxyBase*, hasht_hash, hasht_eq>::Type proxy_map;
!
! typedef HASH_MAPS<const std::string, int, hashstring, eqstring>::Type string_map;
extern std::ostream & operator<<(std::ostream &o, const hasht &x);
NAMESPACE_END // namespace simdata
#endif // __HASHUTILITY_H__
--- 221,232 ----
typedef HASH_MAPS<hasht, Object*, hasht_hash, hasht_eq>::Type cache_map;
typedef HASH_MAPS<hasht, ObjectProxyBase*, hasht_hash, hasht_eq>::Type proxy_map;
! //typedef HASH_MAPS<const std::string, int, hashstring, eqstring>::Type string_map;
extern std::ostream & operator<<(std::ostream &o, const hasht &x);
+
NAMESPACE_END // namespace simdata
+
#endif // __HASHUTILITY_H__
+
Index: Matrix3.h
===================================================================
RCS file: /cvsroot/csp/APPLICATIONS/SimData/Include/SimData/Matrix3.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** Matrix3.h 2 Feb 2003 15:36:09 -0000 1.4
--- Matrix3.h 20 Mar 2003 00:24:47 -0000 1.5
***************
*** 107,116 ****
// arithmetic operations
Matrix3 operator+(const Matrix3& rkMatrix) const;
Matrix3 operator-(const Matrix3& rkMatrix) const;
Matrix3 operator*(const Matrix3& rkMatrix) const;
- Matrix3 operator-() const;
- // matrix * scalar
Matrix3 operator*(double fScalar) const;
#ifndef SWIG
--- 107,117 ----
// arithmetic operations
+ Matrix3 operator-() const;
Matrix3 operator+(const Matrix3& rkMatrix) const;
Matrix3 operator-(const Matrix3& rkMatrix) const;
+ #ifndef SWIG
Matrix3 operator*(const Matrix3& rkMatrix) const;
Matrix3 operator*(double fScalar) const;
+ #endif // SWIG
#ifndef SWIG
***************
*** 120,125 ****
// vector * matrix [1x3 * 3x3 = 1x3]
! // friend Vector3 operator*(const Vector3& rkVector,
! // const Matrix3& rkMatrix);
// scalar * matrix
--- 121,126 ----
// vector * matrix [1x3 * 3x3 = 1x3]
! friend Vector3 operator*(const Vector3& rkVector,
! const Matrix3& rkMatrix);
// scalar * matrix
***************
*** 188,201 ****
friend std::ostream & operator<< (std::ostream & os, const Matrix3 & m);
#endif // SWIG
! //#if defined(SWIG) || defined(SWIGPYTHON)
! // std::string __repr__() { return toString(); }
! /*
! Vector3 __mul__(const Vector3 &v) const;
! Matrix3 __mul__(double fScalar) const;
! */
#ifdef SWIG
- //%rename(__mul__) Matrix::operator*;
%insert("shadow") %{
%}
--- 189,210 ----
friend std::ostream & operator<< (std::ostream & os, const Matrix3 & m);
#endif // SWIG
+
+ // explicit multiplication operators for Python
+ Matrix3 __mul__(const Matrix3 &a) const;
+ Matrix3 __mul__(double a) const;
+ Matrix3 __rmul__(double a) const;
+ Vector3 __mul__(const Vector3 &a) const;
! #ifdef SWIG_____NOTYETREADY
! %extend {
! // bool operator==(const Vector3 & a) { return *self == a; }
! // bool operator!=(const Vector3 & a) { return *self != a; }
! // Vector3 operator*(const Vector3 & a) { return (*self)*a; }
! // Matrix3 operator*(const Matrix3 & a) { return (*self)*a; }
! // Matrix3 operator*(double a) { return (*self)*a; }
! }
! #endif // SWIG
#ifdef SWIG
%insert("shadow") %{
%}
Index: Vector3.h
===================================================================
RCS file: /cvsroot/csp/APPLICATIONS/SimData/Include/SimData/Vector3.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** Vector3.h 18 Mar 2003 06:41:35 -0000 1.4
--- Vector3.h 20 Mar 2003 00:24:47 -0000 1.5
***************
*** 103,106 ****
--- 103,107 ----
Vector3 operator -() const;
+ #ifndef SWIG
/**
* Multiply a vector by a scalar.
***************
*** 111,115 ****
}
- #ifndef SWIG
// friend arithmetic operators
friend Vector3 operator/(const Vector3 &a, double f);
--- 112,115 ----
***************
*** 122,126 ****
double Length() const;
double LengthSquared() const;
! bool IsNull();
Vector3 & Normalize();
double Unitize(double fTolerance = 1e-06);
--- 122,126 ----
double Length() const;
double LengthSquared() const;
! bool IsNull() const;
Vector3 & Normalize();
double Unitize(double fTolerance = 1e-06);
***************
*** 136,146 ****
#endif // SWIG
! Vector3 Cross(const Vector3 & a);
! double Dot(const Vector3 & a);
! std::vector<double> GetElements();
! Matrix3 StarMatrix();
! void Print(FILE * stream);
static const Vector3 ZERO;
--- 136,146 ----
#endif // SWIG
! Vector3 Cross(const Vector3 & a) const;
! double Dot(const Vector3 & a) const;
! std::vector<double> GetElements() const;
! Matrix3 StarMatrix() const;
! void Print(FILE * stream) const;
static const Vector3 ZERO;
***************
*** 155,163 ****
virtual std::string asString() const;
#ifdef SWIG
%extend {
bool operator==(const Vector3 & a) { return *self == a; }
bool operator!=(const Vector3 & a) { return *self != a; }
- double operator*(const Vector3 & a) { return self->Dot(a); }
}
#endif // SWIG
--- 155,167 ----
virtual std::string asString() const;
+ double __mul__(const Vector3 & a) const { return Dot(a); }
+ Vector3 __mul__(const Matrix3 & a) const;
+ Vector3 __mul__(double a) const { return (*this)*a; }
+ Vector3 __rmul__(double a) const { return (*this)*a; }
+
#ifdef SWIG
%extend {
bool operator==(const Vector3 & a) { return *self == a; }
bool operator!=(const Vector3 & a) { return *self != a; }
}
#endif // SWIG
Index: Vector3.inl
===================================================================
RCS file: /cvsroot/csp/APPLICATIONS/SimData/Include/SimData/Vector3.inl,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** Vector3.inl 18 Mar 2003 10:04:04 -0000 1.4
--- Vector3.inl 20 Mar 2003 00:24:47 -0000 1.5
***************
*** 242,246 ****
* Determine if all the components of the vector are zero.
*/
! inline bool Vector3::IsNull()
{
return ((x == 0.0f) && (y == 0.0f) && (z == 0.0f));
--- 242,246 ----
* Determine if all the components of the vector are zero.
*/
! inline bool Vector3::IsNull() const
{
return ((x == 0.0f) && (y == 0.0f) && (z == 0.0f));
Index: ns-simdata.h
===================================================================
RCS file: /cvsroot/csp/APPLICATIONS/SimData/Include/SimData/ns-simdata.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** ns-simdata.h 28 Jan 2003 23:26:06 -0000 1.2
--- ns-simdata.h 20 Mar 2003 00:24:47 -0000 1.3
***************
*** 28,34 ****
#define __NS_SIMDATA_H__
- #ifndef USE_NAMESPACE_SIMDATA
// turn on the simdata namespace by default
#define USE_NAMESPACE_SIMDATA
#endif // USE_NAMESPACE_SIMDATA
--- 28,36 ----
#define __NS_SIMDATA_H__
// turn on the simdata namespace by default
#define USE_NAMESPACE_SIMDATA
+
+ #ifdef NO_NAMESPACE_SIMDATA
+ #undef USE_NAMESPACE_SIMDATA
#endif // USE_NAMESPACE_SIMDATA
|