VR-Forces 4.3 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
debugDrawerNameManager.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2011 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
6 #pragma once
7 
10 
12 #include "vlutil/vlString.h"
13 #include "vlutil/vlShmPool.h"
14 #include <vector>
15 #include <string>
16 
17 #include <boost/interprocess/sync/scoped_lock.hpp>
18 #include <boost/interprocess/sync/named_mutex.hpp>
19 
21 {
22 public:
23  typedef boost::interprocess::named_mutex mutex;
24  typedef boost::interprocess::scoped_lock<mutex> scoped_lock;
25 
26  static const size_t NumberOfNames = 200;
27  static const size_t MaxTagLength = 200;
28 
30  {
31  DtDebugDrawerSharedMemoryNoType = 0,
32  DtDebugDrawerSharedMemoryFeaturesType = 1,
33  DtDebugDrawerSharedMemoryVRFType = 2,
34  DtDebugDrawerSharedMemoryBHaveType = 3,
35  DtDebugDrawerSharedMemoryFeaturesSourceType = 4
36  };
37 
38  class ScopedLock
39  {
40  public:
42  : lock(manager.myMutex)
43  {
44  }
45 
46  private:
48  };
49 
50  friend class ScopedLock;
51 
52  static void SetEnabled(bool);
53  static bool isEnabled();
54 
56  virtual ~DtDebugDrawerNameManager();
57  virtual void init();
58  virtual long addAndCreateNewName(MemoryType type);
59  virtual long addAndCreateNewName(MemoryType type, std::string tag);
60  virtual bool activate(long name, bool state = true);
61  virtual void removeName(long name);
62 
63  struct Slot
64  {
65  Slot(long name, std::string tag)
66  : name(name), tag(tag) { }
67 
68  long name;
69  std::string tag;
70  };
71 
72  virtual std::vector<Slot> getMemoryBlockNamesByType(MemoryType memoryType);
73 
74  virtual DtString blockDescription();
75 
76 protected:
77  struct DtMemoryHeader;
78 
79  mutable mutex myMutex;
80 
82  char* myMemoryPtr;
84  DtMemoryHeader* myHeader;
86  DtSharedMemoryPoolManager* myManager;
87 };
88 

Document ID: Generated on Wed Mar 11 21:20:57 EDT 2015 from SVN revision 150940
Copyright © 2005-2014 VT MÄK. All Rights Reserved (www.mak.com)