Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

misc.h File Reference

This header declares miscellaneous macros, small help functions and const values. More...

#include <complex>
#include <cmath>

Go to the source code of this file.

Namespaces

namespace  simth

Constants for gcc2 compatibility

These constants are defined here if they haven't been defined before, which is the case in some gcc2 setups.

#define M_PI   3.14159265358979323846
#define M_SQRT2   1.41421356237309504880
#define M_SQRT1_2   0.70710678118654752440

Global functions.

This section contains globally defined (template) functions which do not particularly refer to any classes. These functions are defined in misc.h.

Global functions by definition should rather be avoided in an object oriented library. Please try to add this functionality inside your objects. If you really really think a global function would make sense, then please add a detailed description about the intended use case and (especially for template functions) potential side-effects.

Globally defined functions which only make sense with respect to certain classes should be especially avoided and rather be defined inside these classes.

template<class Type>
Type sqr (Type a)
 Returns the square of a parameter.

Global constants for the simulation system

const double PI = M_PI
const double PI2 = 2.0 * PI
const long double ZERO_THRESHOLD = 1.0E-10
const unsigned int MAX_BITS_PER_SYMBOL = 8
const unsigned int MAX_STATES_PER_SYMBOL = 1<<MAX_BITS_PER_SYMBOL
const unsigned int MAX_GENERATOR_POLYNOM = 10000

Defines

#define DEBUG   0
#define SECURITY   1

Typedefs

typedef std::complex< double > Complex
 Type for complex-valued numbers.


Detailed Description

This header declares miscellaneous macros, small help functions and const values.

Note: This header file used to depend on config.h. This was a bad idea, since config.h should be included by the cpp file (of the respective library, i.e. that's a different config.h than the one in simthetic) and not by the header file. This dependency has been removed on 2004-05-03.


Define Documentation

#define DEBUG   0
 

Switch debugging mode on or off.

#define SECURITY   1
 

This macro is set to "1" by default and enables useful range/security checks. It can be disabled upon extra request, if you think this might increase runtime a little bit. But usually the checks flagged by this macro should be always enabled anyways. If there are runtime checks that make sense to be disabled in some circumstances, you should consider flagging them by the DEBUG macro.

#define M_PI   3.14159265358979323846
 

pi.

#define M_SQRT2   1.41421356237309504880
 

sqrt(2).

#define M_SQRT1_2   0.70710678118654752440
 

1/sqrt(2).


Typedef Documentation

typedef std::complex<double> simth::Complex
 

Type for complex-valued numbers.

Throughout all of Simthetic, we use this type for the complex numbers.


Function Documentation

template<class Type>
Type sqr Type  a  )  [inline]
 

Returns the square of a parameter.

Template function for the squaring of a parameter if and only if the operator "multiplication" is defined for this type (and is commutative). In other words, this will probably work for int, double, and Complex, but definitely not for vectors and matrices.


Variable Documentation

const double simth::PI = M_PI
 

Pi

const double simth::PI2 = 2.0 * PI
 

2*Pi

const long double simth::ZERO_THRESHOLD = 1.0E-10
 

The threshold below which some routines will assume values to be zero.

const unsigned int simth::MAX_BITS_PER_SYMBOL = 8
 

Upper limit on the complexity of the constellation diagram, by limiting the possible number of bits per constellation symbol.

This is used when allocating memory in the viterbi decoding, and therefore it shouldn't be set higher than necessary. (FIXME: is this correct? Also, can't we increase this to, say, 16?)

const unsigned int simth::MAX_STATES_PER_SYMBOL = 1<<MAX_BITS_PER_SYMBOL
 

Upper limit on the complexity of the constellation diagram, by limiting the possible number of constellation symbols -- which is a direct function of MAX_BITS_PER_SYMBOL.

This is used when allocating memory in the viterbi decoding, and therefore it shouldn't be set higher than necessary. (FIXME: is this correct? Also, can't we increase this to, say, 16?)

const unsigned int simth::MAX_GENERATOR_POLYNOM = 10000
 

FIXME: what is this?


Generated on Mon Apr 24 21:19:19 2006 for simthetic by  doxygen 1.4.1