cisst-saw
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
mtsMailBox.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): Peter Kazanzides
7  Created on: 2007-09-05
8 
9  (C) Copyright 2007-2014 Johns Hopkins University (JHU), All Rights Reserved.
10 
11 --- begin cisst license - do not edit ---
12 
13 This software is provided "as is" under an open source license, with
14 no warranty. The complete license can be found in license.txt and
15 http://www.cisst.org/cisst/license.txt.
16 
17 --- end cisst license ---
18 */
19 
20 
26 #ifndef _mtsMailBox_h
27 #define _mtsMailBox_h
28 
30 
31 // Always include last
33 
34 class mtsExecutionResult;
35 
37 {
38  mtsQueue<mtsCommandBase *> CommandQueue;
39 
41  std::string Name;
42 
47  mtsCallableVoidBase * PostCommandQueuedCallable;
48 
53  mtsCommandVoid * PostCommandDequeuedCommand;
54 
59  mtsCommandVoid * PostCommandReturnDequeuedCommand;
60 
62  void TriggerPostQueuedCommandIfNeeded(bool isBlocking, bool isBlockingReturn);
63 
66  void TriggerFinishedEventIfNeeded(const std::string &commandName, mtsCommandWriteBase *finishedEvent,
67  mtsGenericObject *resultPointer, const mtsExecutionResult &result) const;
68 
69 public:
70  mtsMailBox(const std::string & name,
71  size_t size,
72  mtsCallableVoidBase * postCommandQueuedCallable = 0);
73 
74  ~mtsMailBox(void);
75 
77  const std::string & GetName(void) const;
78 
81  bool Write(mtsCommandBase * command);
82 
84  bool ExecuteNext(void);
85 
90  void SetSize(size_t size);
91 
93  bool IsEmpty(void) const;
94 
96  bool IsFull(void) const;
97 
102  void SetPostCommandDequeuedCommand(mtsCommandVoid * command);
103  mtsCommandVoid *GetPostCommandDequeuedCommand(void) const;
104 
109  void SetPostCommandReturnDequeuedCommand(mtsCommandVoid * command);
110  mtsCommandVoid *GetPostCommandReturnDequeuedCommand(void) const;
111 
112 };
113 
114 
115 #endif // _mtsMailbox_h
116 
#define CISST_EXPORT
Definition: cmnExportMacros.h:50
Definition: mtsCommandVoid.h:44
Definition: mtsCallableVoidBase.h:39
Base class for data object in cisstMultiTask.
Definition: mtsGenericObject.h:56
Definition: mtsCommandWriteBase.h:40
Defines mtsQueue.
Definition: mtsExecutionResult.h:34
Rules of exporting.
Definition: mtsCommandBase.h:43
Definition: mtsMailBox.h:36