File: ArServerData.h

package info (click to toggle)
libaria 2.8.0%2Brepack-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 13,628 kB
  • ctags: 16,574
  • sloc: cpp: 135,490; makefile: 925; python: 597; java: 570; ansic: 182
file content (70 lines) | stat: -rw-r--r-- 2,565 bytes parent folder | download | duplicates (2)
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
#ifndef ARSERVERDATA_H
#define ARSERVERDATA_H

/// class to hold information about the different data the server has
/**
   This class is mostly just for holding all the information about one
   of the server data entires in one convenient spot
**/

#include "Aria.h"

class ArServerClient;
class ArNetPacket;


class ArServerData
{
public:
  /// Constructor
  AREXPORT ArServerData(
	  const char *name, const char *description, unsigned int command,
	  ArFunctor2<ArServerClient *, ArNetPacket *> *functor,
	  const char *argumentDescription, const char *returnDescription,
	  const char *commandGroup = NULL, const char *dataFlags = NULL,
	  ArRetFunctor1<long, unsigned int> *getFrequencyFunctor = NULL,
	  ArFunctor2<long, unsigned int> *requestChangedFunctor = NULL, 
	  ArRetFunctor2<bool, ArServerClient *, ArNetPacket *> 
	  *requestOnceFunctor = NULL);
  /// Destructor
  AREXPORT virtual ~ArServerData();
  const char *getName(void) { return myName.c_str(); }
  const char *getDescription(void) { return myDescription.c_str(); }
  unsigned int getCommand(void) { return myCommand; }
  ArFunctor2<ArServerClient *, ArNetPacket *> *getFunctor(void) 
    { return myFunctor; };
  const char *getArgumentDescription(void) 
    { return myArgumentDescription.c_str(); }
  const char *getReturnDescription(void) 
    { return myReturnDescription.c_str(); }
  const char *getCommandGroup(void) 
    { return myCommandGroup.c_str(); }
  ArRetFunctor2<bool, ArServerClient *, ArNetPacket *> *getRequestOnceFunctor(void)
    { return myRequestOnceFunctor; }
  AREXPORT bool hasDataFlag(const char *dataFlag);
  AREXPORT bool addDataFlags(const char *dataFlags);
  AREXPORT bool remDataFlag(const char *dataFlag);
  bool isSlowPacket(void) { return mySlowPacket; }
  bool isIdlePacket(void) { return myIdlePacket; }
  const char *getDataFlagsString(void) 
    { return myDataFlagsBuilder.getFullString(); }
  AREXPORT void callRequestChangedFunctor(void);
protected:
  std::string myName;
  std::string myDescription;
  std::string myArgumentDescription;
  std::string myReturnDescription;
  std::string myCommandGroup;
  std::string myRawDataFlags;
  ArMutex myDataMutex;
  ArArgumentBuilder myDataFlagsBuilder;
  unsigned int myCommand;
  ArFunctor2<ArServerClient *, ArNetPacket *> *myFunctor;
  ArRetFunctor1<long, unsigned int> *myGetFrequencyFunctor;
  ArFunctor2<long, unsigned int> *myRequestChangedFunctor;
  ArRetFunctor2<bool, ArServerClient *, ArNetPacket *> *myRequestOnceFunctor;
  bool mySlowPacket;
  bool myIdlePacket;
};

#endif // ARSERVERDATA_H