~ubuntu-branches/ubuntu/saucy/resiprocate/saucy-proposed

« back to all changes in this revision

Viewing changes to tfm/SequenceSet.hxx

  • Committer: Package Import Robot
  • Author(s): Daniel Pocock
  • Date: 2012-05-17 19:29:59 UTC
  • Revision ID: package-import@ubuntu.com-20120517192959-vv00m77isztdy64q
Tags: upstream-1.8.2
ImportĀ upstreamĀ versionĀ 1.8.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef SequenceSet_hxx
 
2
#define SequenceSet_hxx
 
3
 
 
4
#include <iosfwd>
 
5
#include <list>
 
6
#include <set>
 
7
#include <memory>
 
8
#include <boost/shared_ptr.hpp>
 
9
 
 
10
#include "tfm/TestEndPoint.hxx"
 
11
#include "rutil/BaseException.hxx"
 
12
#include "rutil/Data.hxx"
 
13
#include "resip/stack/ValueFifo.hxx"
 
14
 
 
15
// .dlb. add an onComplete action?
 
16
 
 
17
// container for a set of Sequences that execute together
 
18
class SequenceSet
 
19
{
 
20
   public:
 
21
      friend class SequenceClass;
 
22
 
 
23
      SequenceSet();
 
24
      ~SequenceSet();
 
25
 
 
26
      void enqueue(boost::shared_ptr<Event> event);
 
27
      long enqueue(boost::shared_ptr<Event> event, int delay);
 
28
      void globalFailure(const resip::Data& message);
 
29
      void globalFailure(resip::BaseException& e);
 
30
      bool executionFailed() const;
 
31
 
 
32
      bool exec();
 
33
      resip::Data getExplanation() const { return mExplanation; }
 
34
      resip::Data getFileName() const { return mFileName; }
 
35
      int getLineNumber() const { return mLineNumber; }
 
36
 
 
37
      // .dlb. boy is this wrong...
 
38
      void outputToInfo();
 
39
 
 
40
      void clear();
 
41
 
 
42
      boost::shared_ptr<SequenceSet> getHandle() { return mHandle; }
 
43
      void release() { mHandle.reset(); }
 
44
 
 
45
   protected:
 
46
      void handle(boost::shared_ptr<Event> event);
 
47
      std::list<SequenceClass*> mSequences;
 
48
      std::set<SequenceClass*> mActiveSet;
 
49
 
 
50
      void handleEvent(boost::shared_ptr<Event> event);
 
51
 
 
52
      typedef resip::ValueFifo< boost::shared_ptr<Event> > EventFifo;
 
53
      EventFifo mEventFifo;
 
54
 
 
55
      bool mFailed;
 
56
 
 
57
      resip::Data mFileName;
 
58
      int mLineNumber;
 
59
      resip::Data mExplanation;
 
60
 
 
61
   private:
 
62
      void preLoop();
 
63
      bool loop();
 
64
      void postLoop();
 
65
 
 
66
      bool mReset;
 
67
 
 
68
   public:
 
69
 
 
70
   private:
 
71
      boost::shared_ptr<SequenceSet> mHandle;      
 
72
      // no value semanitcs
 
73
      SequenceSet(const SequenceSet&);
 
74
      SequenceSet& operator=(const SequenceSet&);
 
75
};
 
76
 
 
77
EncodeStream&
 
78
operator<<(EncodeStream& str, const SequenceSet& sset);
 
79
 
 
80
#endif
 
81
/*
 
82
  Copyright (c) 2005, PurpleComm, Inc. 
 
83
  All rights reserved.
 
84
 
 
85
  Redistribution and use in source and binary forms, with or without modification,
 
86
  are permitted provided that the following conditions are met:
 
87
 
 
88
  * Redistributions of source code must retain the above copyright notice, this
 
89
    list of conditions and the following disclaimer.
 
90
  * Redistributions in binary form must reproduce the above copyright notice,
 
91
    this list of conditions and the following disclaimer in the documentation
 
92
    and/or other materials provided with the distribution.
 
93
  * Neither the name of PurpleComm, Inc. nor the names of its contributors may
 
94
    be used to endorse or promote products derived from this software without
 
95
    specific prior written permission.
 
96
 
 
97
  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 
98
  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 
99
  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 
100
  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
 
101
  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 
102
  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 
103
  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 
104
  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 
105
  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 
106
  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
107
*/