24 #include <QStringList> 26 #include "Eigen/Dense" 29 #include "gaiaexception.h" 30 #include "debugging.h" 31 #include "gvarlengtharray.h" 36 typedef unsigned int uint;
37 typedef unsigned char uint8;
38 typedef signed int sint;
39 typedef signed char sint8;
45 typedef uint16_t uint16;
46 typedef uint32_t uint32;
47 typedef uint64_t uint64;
48 typedef int16_t sint16;
49 typedef int32_t sint32;
50 typedef int64_t sint64;
54 typedef unsigned __int16 uint16;
55 typedef unsigned __int32 uint32;
56 typedef unsigned __int64 uint64;
57 typedef __int16 sint16;
58 typedef __int32 sint32;
59 typedef __int64 sint64;
78 for (
int i=0; i<size; i++) (*
this)[i] = value;
83 const T& at(
int i)
const {
return (*
this)[i]; }
84 Array& operator<<(
const T& x) { this->append(x);
return *
this; }
85 T& front() {
return (*
this)[0]; }
86 const T& front()
const {
return at(0); }
87 Array& fill(
const T& val,
int size) {
89 for (
int i=0; i<size; i++) {
105 bool operator==(
const Array<T>& rhs)
const {
106 if (this->size() != rhs.size())
return false;
107 for (
int i=0; i<size(); i++) {
108 if (at(i) != rhs.at(i))
return false;
113 bool operator!=(
const Array<T>& rhs)
const {
return !operator==(rhs); }
117 template <
typename T>
118 QDataStream& operator<<(QDataStream& out, const Array<T>& array) {
119 out << (qint32)array.size();
120 for (
int i=0; i<array.size(); i++) {
126 template <
typename T>
127 QDataStream& operator>>(QDataStream& in,
Array<T>& array) {
131 for (
int i=0; i<size; i++) {
142 template <
typename Key,
typename Value,
typename ExceptionType = GaiaException>
145 const Value& value(
const Key& key)
const {
146 typename QMap<Key, Value>::const_iterator it = this->find(key);
147 if (it == this->end()) {
148 throw ExceptionType(
"Key '", key,
"' not found in map");
154 const Value& value(
const Key& key,
const Value& defaultValue)
const {
158 catch (ExceptionType&) {
163 inline const Value& operator[](
const Key& key)
const {
167 Value& value(
const Key& key) {
168 typename QMap<Key, Value>::iterator it = this->find(key);
169 if (it == this->end()) {
170 throw ExceptionType(
"Key '", key,
"' not found in map");
175 inline Value& operator[](
const Key& key) {
180 template <
typename Key,
typename Value,
typename ExceptionType>
181 Stringifier& operator<<(Stringifier& out, const GaiaMap<Key, Value, ExceptionType>& gmap) {
183 if (gmap.isEmpty())
return out <<
"}";
185 out <<
" " << it.key() <<
": " << it.value();
186 for (++it; it != gmap.constEnd(); ++it) {
187 out <<
", " << it.key() <<
": " << it.value();
194 typedef Eigen::Matrix<float, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> MatrixRXf;
195 typedef Eigen::RowVectorXf FrozenPoint;
200 #endif // GAIA_TYPES_H Definition: debugging.h:82
Map class (derived from QMap) but that throws a custom Exception instead of returning a default const...
Definition: types.h:143
Main Gaia namespace, which contains all the library functions.
Definition: addfield.cpp:22
Definition: gvarlengtharray.h:77
Definition: keydistance.cpp:24