N-sim
Emulation and simulation of
Wireless Sensor Networks



   Home


   Project Page


   Download


   CVS



   Installation


   Configuration


   Plug-ins




 Hosted by
SourceForge.net Logo

/home/brennan/n-sim/OrbisQuartus/shared/environ_object.h

Go to the documentation of this file.
00001 
00014 /*
00015  * Copyright 2007. Los Alamos National Security, LLC. This material
00016  * was produced under U.S. Government contract DE-AC52-06NA25396 for
00017  * Los Alamos National Laboratory (LANL), which is operated by Los
00018  * Alamos National Security, LLC, for the Department of Energy. The
00019  * U.S. Government has rights to use, reproduce, and distribute this
00020  * software. NEITHER THE GOVERNMENT NOR LOS ALAMOS NATIONAL SECURITY,
00021  * LLC, MAKES ANY WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LEGAL
00022  * LIABILITY FOR THE USE OF THIS SOFTWARE. If software is modified to
00023  * produce derivative works, such modified software should be clearly
00024  * marked, so as not to confuse it with the version available from LANL.
00025  *
00026  * Additionally, this program is free software; you can redistribute
00027  * it and/or modify it under the terms of the GNU General Public
00028  * License as published by the Free Software Foundation; version 2 of
00029  * the License. Accordingly, this program is distributed in the hope
00030  * it will be useful, but WITHOUT ANY WARRANTY; without even the
00031  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00032  * PURPOSE. See the GNU General Public License for more details.
00033  */
00034 
00035 
00036 #ifndef _ENVIRON_OBJECT_H_
00037 #define _ENVIRON_OBJECT_H_
00038 
00039 #include <ode/ode.h>
00040 #include "avl.h"
00041 #include "coordinates.h"
00042 
00043 
00044 #define MIN_SIZE           (1.1e-100)
00045 
00046 
00047 enum Environ_type { 
00048         SourceClass,
00049         NodeClass,
00050         SensorClass,
00051         InterferorClass,
00052         AffectorClass,
00053         PropagatorClass,
00054 };
00055 
00056 
00057 class Environ_object : public Comparable<unsigned long> {
00058  protected:
00059         const char *key_format_string() { return "%lu"; };
00060 
00061         enum Environ_type class_type;
00062         char name[MAX_NAME];
00063         dxGeom *shape;
00064         char type[MAX_NAME];
00065         unsigned short modified;
00066         Coordinates coords;
00067 
00068         void __decimal2coord(Coordinates coord);
00069         void __coord2decimal(Coordinates coord);
00070 
00071  public:
00072         Environ_object() : Comparable<unsigned long>(0UL) { 
00073                 modified = 0;
00074                 memset(name, 0, MAX_NAME);
00075                 memset(type, 0, MAX_NAME);
00076         };
00077 
00078         Environ_object(unsigned long id) : Comparable<unsigned long>(id) { 
00079                 modified = 0;
00080                 memset(name, 0, MAX_NAME);
00081                 memset(type, 0, MAX_NAME);
00082         };
00083 
00084         unsigned long id() { return key; };
00085         char *get_type() { return type; };
00086         void get_coordinates(double*, double*, double*);
00087         void get_location(double*, double*, double*);
00088 
00089         void modify() { modified = 1; };
00090         unsigned short is_modified() { return modified; };
00091         void set_coordinates(Coordinates, double, double, double);
00092         void set_location(Coordinates, double, double, double);
00093         double distance(Environ_object *other);
00094 };
00095 
00096 
00097 #endif  // _ENVIRON_OBJECT_H_


© 2007, Los Alamos National Security, LLC.