/usr/include/Aria/ariaInternal.h is in libaria-dev 2.8.0+repack-1.2ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 | /*
Adept MobileRobots Robotics Interface for Applications (ARIA)
Copyright (C) 2004, 2005 ActivMedia Robotics LLC
Copyright (C) 2006, 2007, 2008, 2009, 2010 MobileRobots Inc.
Copyright (C) 2011, 2012, 2013 Adept Technology
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
If you wish to redistribute ARIA under different terms, contact
Adept MobileRobots for information about a commercial version of ARIA at
robots@mobilerobots.com or
Adept MobileRobots, 10 Columbia Drive, Amherst, NH 03031; +1-603-881-7960
*/
#ifndef ARIAINTERNAL_H
#define ARIAINTERNAL_H
#include "ArMutex.h"
#include "ArFunctor.h"
#include "ArConfig.h"
#ifndef ARINTERFACE
#include "ArStringInfoGroup.h"
class ArRobot;
class ArRobotJoyHandler;
class ArSonarMTX;
class ArBatteryMTX;
class ArLCDMTX;
#endif // ARINTERFACE
class ArKeyHandler;
class ArJoyHandler;
/** Contains global initialization, deinitialization and other global functions
@ingroup ImportantClasses
*/
class Aria
{
public:
typedef enum {
SIGHANDLE_SINGLE, ///< Setup signal handlers in a global, non-thread way
SIGHANDLE_THREAD, ///< Setup a dedicated signal handling thread
SIGHANDLE_NONE ///< Do no signal handling
} SigHandleMethod;
/// Initialize Aria global data struture and perform OS-specific initialization, including adding OS signal handlers on Linux, initializing sockets library on Windows, etc.
AREXPORT static void init(SigHandleMethod method = SIGHANDLE_THREAD,
bool initSockets = true,
bool sigHandleExitNotShutdown = true);
/// Performs OS-specific deinitialization, used by shutdown() and exit().
AREXPORT static void uninit();
/// Adds a callback to call when Aria is initialized using init()
AREXPORT static void addInitCallBack(ArFunctor *cb, ArListPos::Pos position);
/// Adds a callback to call when Aria is uninititialized using uninit()
AREXPORT static void addUninitCallBack(ArFunctor *cb,
ArListPos::Pos position);
/// Shutdown all Aria processes/threads
AREXPORT static void shutdown();
/// Shutdown all Aria processes/threads, call exit callbacks, and exit the program
AREXPORT static void exit(int exitCode = 0);
/// Sees if Aria is still running (mostly for the thread in main)
AREXPORT static bool getRunning(void);
/// Sets the directory that ARIA resides in, to override default
AREXPORT static void setDirectory(const char * directory);
/// Gets the directory that ARIA resides in
AREXPORT static const char *getDirectory(void);
/// Parses the arguments for the program (calls all the callbacks added with addParseArgsCB())
AREXPORT static bool parseArgs(void);
/// Logs all the options for the program (Calls all the callbacks added with addLogOptionsCB())
AREXPORT static void logOptions(void);
/// Sets the key handler, so that other classes can find it using getKeyHandler()
AREXPORT static void setKeyHandler(ArKeyHandler *keyHandler);
/// Gets a pointer to the global key handler, if one has been set with setKeyHandler()
AREXPORT static ArKeyHandler *getKeyHandler(void);
/// Sets the joystick handler, so that other classes can find it using getJoyHandler()
AREXPORT static void setJoyHandler(ArJoyHandler *joyHandler);
/// Get a pointer to the joystick handler if one has been set with setJoyHandler()
AREXPORT static ArJoyHandler *getJoyHandler(void);
/// Adds a functor to by called before program exit by Aria::exit()
AREXPORT static void addExitCallback(ArFunctor *functor, int position = 50);
/// Removes a functor to by called before program exit by Aria::exit()
AREXPORT static void remExitCallback(ArFunctor *functor);
/// Sets the log level for the exit callbacks
AREXPORT static void setExitCallbacksLogLevel(ArLog::LogLevel level);
/// Force an exit of all Aria processes/threads (the old way)
AREXPORT static void exitOld(int exitCode = 0);
/// Internal, the callback for the signal handling
AREXPORT static void signalHandlerCB(int sig);
/// Internal, calls the exit callbacks
AREXPORT static void callExitCallbacks(void);
/// Adds a callback for when we parse arguments
AREXPORT static void addParseArgsCB(ArRetFunctor<bool> *functor,
int position = 50);
/// Sets the log level for the parsing function
AREXPORT static void setParseArgLogLevel(ArLog::LogLevel level);
/// Adds a callback for when we log options
AREXPORT static void addLogOptionsCB(ArFunctor *functor, int position = 50);
/// Adds a type of deviceConnection for Aria to be able to create
AREXPORT static bool deviceConnectionAddCreator(
const char *deviceConnectionType,
ArRetFunctor3<ArDeviceConnection *, const char *, const char *, const char *> *creator);
/// Gets a list of the possible deviceConnection types
AREXPORT static const char *deviceConnectionGetTypes(void);
/// Gets a list of the possible deviceConnection types (for use in the config)
AREXPORT static const char *deviceConnectionGetChoices(void);
/// Creates a deviceConnection of the given type
AREXPORT static ArDeviceConnection *deviceConnectionCreate(
const char *deviceConnectionType, const char *port,
const char *defaultInfo,
const char *prefix = "Aria::deviceConnectionCreate");
#ifndef ARINTERFACE
/// Sets the robot joystick handler, so that other classes can find it
AREXPORT static void setRobotJoyHandler(ArRobotJoyHandler *robotJoyHandler);
/// Gets the robot joystick handler if one has been set
AREXPORT static ArRobotJoyHandler *getRobotJoyHandler(void);
/// Gets the ArConfig for this program
AREXPORT static ArConfig *getConfig(void);
/// Gets the ArStringInfoGroup for this program
AREXPORT static ArStringInfoGroup *getInfoGroup(void);
/// Add a robot to the global list of robots
AREXPORT static void addRobot(ArRobot *robot);
/// Remove a robot from the global list of robots
AREXPORT static void delRobot(ArRobot *robot);
/// Finds a robot in the global list of robots, by name
AREXPORT static ArRobot *findRobot(char *name);
/// Get a copy of the global robot list
AREXPORT static std::list<ArRobot*> * getRobotList();
/// Gets the maximum number of lasers to use
AREXPORT static int getMaxNumLasers(void);
/// Sets the maximum number of lasers to use
AREXPORT static void setMaxNumLasers(int maxNumLasers);
/// Gets the maximum number of sonars to use
AREXPORT static int getMaxNumSonarBoards(void);
/// Sets the maximum number of sonars to use
AREXPORT static void setMaxNumSonarBoards(int maxNumSonarBoards);
/// Gets the maximum number of batteris to use
AREXPORT static int getMaxNumBatteries(void);
/// Sets the maximum number of batteries to use
AREXPORT static void setMaxNumBatteries(int maxNumBatteries);
/// Gets the maximum number of lcds to use
AREXPORT static int getMaxNumLCDs(void);
/// Sets the maximum number of batteries to use
AREXPORT static void setMaxNumLCDs(int maxNumLCDs);
/// Creates a laser of the given type
AREXPORT static ArLaser *laserCreate(
const char *laserType, int laserNumber,
const char *prefix = "Aria::laserCreate");
/// Adds a type of laser for Aria to be able to create
AREXPORT static bool laserAddCreator(
const char *laserType,
ArRetFunctor2<ArLaser *, int, const char *> *creator);
/// Gets a list of the possible laser types
AREXPORT static const char *laserGetTypes(void);
/// Gets a list of the possible laser types (for use in the config)
AREXPORT static const char *laserGetChoices(void);
/// Creates a battery of the given type
AREXPORT static ArBatteryMTX *batteryCreate(
const char *batteryType, int batteryNumber,
const char *prefix = "Aria::batteryCreate");
/// Adds a type of battery for Aria to be able to create
AREXPORT static bool batteryAddCreator(
const char *batteryType,
ArRetFunctor2<ArBatteryMTX *, int, const char *> *creator);
/// Gets a list of the possible battery types
AREXPORT static const char *batteryGetTypes(void);
/// Gets a list of the possible battery types (for use in the config)
AREXPORT static const char *batteryGetChoices(void);
/// Creates a lcd of the given type
AREXPORT static ArLCDMTX *lcdCreate(
const char *lcdType, int lcdNumber,
const char *prefix = "Aria::lcdCreate");
/// Adds a type of lcd for Aria to be able to create
AREXPORT static bool lcdAddCreator(
const char *lcdType,
ArRetFunctor2<ArLCDMTX *, int, const char *> *creator);
/// Gets a list of the possible lcd types
AREXPORT static const char *lcdGetTypes(void);
/// Gets a list of the possible lcd types (for use in the config)
AREXPORT static const char *lcdGetChoices(void);
/// Creates a sonar of the given type
AREXPORT static ArSonarMTX *sonarCreate(
const char *sonarType, int sonarNumber,
const char *prefix = "Aria::sonarCreate");
/// Adds a type of sonar for Aria to be able to create
AREXPORT static bool sonarAddCreator(
const char *sonarType,
ArRetFunctor2<ArSonarMTX *, int, const char *> *creator);
/// Gets a list of the possible sonar types
AREXPORT static const char *sonarGetTypes(void);
/// Gets a list of the possible sonar types (for use in the config)
AREXPORT static const char *sonarGetChoices(void);
/// Set maximum limit on video devices (used by ArVideo library)
AREXPORT static void setMaxNumVideoDevices(size_t n);
/// Get maximum limit on video devices (used by ArVideo library)
AREXPORT static size_t getMaxNumVideoDevices();
/// Set maximum limit on PTZ or PTU devices, used by ArPTZConnector. Call before connecting to PTZ devices with ArPTZConnector.
AREXPORT static void setMaxNumPTZs(size_t n);
/// Set maximum limit on PTZ or PTU devices, used by ArPTZConnector.
AREXPORT static size_t getMaxNumPTZs();
#endif // ARINTERFACE
/// Gets the identifier (for humans) used for this instance of Aria
AREXPORT static const char *getIdentifier(void);
/// Sets the identifier (for humans) used for this instance of Aria
AREXPORT static void setIdentifier(const char *identifier);
protected:
static bool ourInited;
static ArGlobalFunctor1<int> ourSignalHandlerCB;
static bool ourRunning;
static ArMutex ourShuttingDownMutex;
static bool ourShuttingDown;
static bool ourExiting;
static std::string ourDirectory;
static std::list<ArFunctor*> ourInitCBs;
static std::list<ArFunctor*> ourUninitCBs;
static ArKeyHandler *ourKeyHandler;
static ArJoyHandler *ourJoyHandler;
#ifndef ARINTERFACE
static std::list<ArRobot*> ourRobots;
static ArRobotJoyHandler *ourRobotJoyHandler;
static ArConfig ourConfig;
static ArStringInfoGroup ourInfoGroup;
static int ourMaxNumLasers;
static int ourMaxNumSonarBoards;
static int ourMaxNumBatteries;
static int ourMaxNumLCDs;
static std::map<std::string, ArRetFunctor2<ArLaser *, int, const char *> *, ArStrCaseCmpOp> ourLaserCreatorMap;
static std::string ourLaserTypes;
static std::string ourLaserChoices;
static std::map<std::string, ArRetFunctor2<ArBatteryMTX *, int, const char *> *, ArStrCaseCmpOp> ourBatteryCreatorMap;
static std::string ourBatteryTypes;
static std::string ourBatteryChoices;
static std::map<std::string, ArRetFunctor2<ArLCDMTX *, int, const char *> *, ArStrCaseCmpOp> ourLCDCreatorMap;
static std::string ourLCDTypes;
static std::string ourLCDChoices;
static std::map<std::string, ArRetFunctor2<ArSonarMTX *, int, const char *> *, ArStrCaseCmpOp> ourSonarCreatorMap;
static std::string ourSonarTypes;
static std::string ourSonarChoices;
#endif // ARINTERFACE
static ArMutex ourExitCallbacksMutex;
static std::multimap<int, ArFunctor *> ourExitCallbacks;
static bool ourSigHandleExitNotShutdown;
static std::multimap<int, ArRetFunctor<bool> *> ourParseArgCBs;
static ArLog::LogLevel ourParseArgsLogLevel;
static std::multimap<int, ArFunctor *> ourLogOptionsCBs;
static ArLog::LogLevel ourExitCallbacksLogLevel;
static std::map<std::string, ArRetFunctor3<ArDeviceConnection *, const char *, const char *, const char *> *, ArStrCaseCmpOp> ourDeviceConnectionCreatorMap;
static std::string ourDeviceConnectionTypes;
static std::string ourDeviceConnectionChoices;
static std::string ourIdentifier;
#ifndef ARINTERFACE
static size_t ourMaxNumVideoDevices;
static size_t ourMaxNumPTZs;
#endif
};
#endif // ARIAINTERNAL_H
|