cisst-saw
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
svlWebPublisher.h
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* ex: set filetype=cpp softtabstop=4 shiftwidth=4 tabstop=4 cindent expandtab: */
3 
4 /*
5 
6  Author(s): Balazs Vagvolgyi
7  Created on: 2009-11-04
8 
9  (C) Copyright 2005-2009 Johns Hopkins University (JHU), All Rights
10  Reserved.
11 
12  --- begin cisst license - do not edit ---
13 
14  This software is provided "as is" under an open source license, with
15  no warranty. The complete license can be found in license.txt and
16  http://www.cisst.org/cisst/license.txt.
17 
18  --- end cisst license ---
19 
20 */
21 
22 
23 #ifndef _svlWebPublisher_h
24 #define _svlWebPublisher_h
25 
26 #include <cisstCommon.h>
30 
31 #include <map>
32 #include <string>
33 
34 // Always the last cisst include
35 #include <cisstCommon/cmnExport.h>
36 
37 
38 class svlWebObjectBase;
39 
41 {
43 
44  typedef std::pair<std::string, svlWebObjectBase*> _ObjectPair;
45  typedef std::map<std::string, svlWebObjectBase*> _ObjectMap;
46 
47 public:
48  enum RequestType { GET, POST };
49 
50  svlWebPublisher(unsigned int port, bool fileserver);
51  ~svlWebPublisher();
52 
53  unsigned int GetPort();
54  bool IsFileServer();
55 
56  int Start();
57  void Stop();
58 
59  int AddObject(svlWebObjectBase* object);
60  int RemoveObject(svlWebObjectBase* object);
61  int RemoveObject(const std::string & objectname);
62 
63  svlWebObjectBase* GetObject(const std::string & objectname, RequestType request);
64  void ReleaseObject(svlWebObjectBase* object);
65 
66  void* Proc(int param);
67 private:
69 
70  _ObjectMap Objects;
72  unsigned int Port;
73  bool FileServer;
74  RequestType Request;
75 
76  osaThread* ServerThread;
77  osaThreadSignal ServerSignal;
78  bool ServerInitSuccess;
79 };
80 
82 
83 #endif // _svlWebPublisher_h
84 
#define CISST_EXPORT
Definition: cmnExportMacros.h:50
Definition: osaCriticalSection.h:36
Definition: svlWebObjectBase.h:36
Base class for high level objects.
Definition: cmnGenericObject.h:51
Declaration of osaThread.
Define a thread object.
Definition: osaThread.h:164
Macros to export the symbols of cisstCommon (in a Dll).
Declaration of osaThreadSignal.
#define CMN_DECLARE_SERVICES(hasDynamicCreation, lod)
Definition: cmnClassRegisterMacros.h:116
Definition: svlWebPublisher.h:40
RequestType
Definition: svlWebPublisher.h:48
Definition: osaThreadSignal.h:40
const int CMN_NO_DYNAMIC_CREATION
Definition: cmnClassRegisterMacros.h:328
#define CMN_DECLARE_SERVICES_INSTANTIATION(className)
Definition: cmnClassRegisterMacros.h:202
#define CMN_LOG_ALLOW_DEFAULT
Definition: cmnLogLoD.h:76