Lumiera  0.pre.03
»edit your freedom«
testframe.hpp
Go to the documentation of this file.
1 /*
2  TESTFRAME.hpp - test data frame (stub) for checking Render engine functionality
3 
4  Copyright (C) Lumiera.org
5  2011, Hermann Vosseler <Ichthyostega@web.de>
6 
7  This program is free software; you can redistribute it and/or
8  modify it under the terms of the GNU General Public License as
9  published by the Free Software Foundation; either version 2 of
10  the License, or (at your option) any later version.
11 
12  This program is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with this program; if not, write to the Free Software
19  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 
21 */
22 
28 #ifndef STEAM_ENGINE_TESTFRAME_H
29 #define STEAM_ENGINE_TESTFRAME_H
30 
31 
32 #include <cstdlib>
33 #include <stdint.h>
34 
35 
36 namespace steam {
37 namespace engine {
38 namespace test {
39 
40 
60  class TestFrame
61  {
62  enum StageOfLife {
63  CREATED, EMITTED, DISCARDED
64  };
65 
66  static const size_t BUFFSIZ = 1024;
67 
68  uint64_t distinction_;
69  StageOfLife stage_;
70 
71  char data_[BUFFSIZ];
72 
73  public:
74  ~TestFrame();
75  TestFrame (uint seq=0, uint family=0);
76  TestFrame (TestFrame const&);
77  TestFrame& operator= (TestFrame const&);
78 
84  static bool isAlive (void* memLocation);
85 
88  static bool isDead (void* memLocation);
89 
90  bool isAlive() const;
91  bool isDead() const;
92  bool isSane() const;
93 
94  bool operator== (void* memLocation) const;
95 
96  friend bool operator== (TestFrame const& f1, TestFrame const& f2) { return f1.contentEquals(f2); }
97  friend bool operator!= (TestFrame const& f1, TestFrame const& f2) { return !f1.contentEquals(f2); }
98 
99  private:
100  bool contentEquals (TestFrame const& o) const;
101  bool verifyData() const;
102  void buildData ();
103  };
104 
105 
106 
113  TestFrame& testData (uint seqNr);
114 
115  TestFrame& testData (uint chanNr, uint seqNr);
116 
117 
120  void resetTestFrames();
121 
122 
123 
124 }}} // namespace steam::engine::test
125 #endif
static bool isAlive(void *memLocation)
Helper to verify that a given memory location holds an active TestFrame instance (created, not yet destroyed)
Definition: testframe.cpp:221
Mock data frame for simulated rendering.
Definition: testframe.hpp:60
Definition: run.hpp:49
TestFrame & testData(uint seqNr)
Helper to access a specific frame of test data at a fixed memory location.
Definition: testframe.cpp:155
Steam-Layer implementation namespace root.
void resetTestFrames()
discards all the TestFrame instances and initialises an empty table of test frames ...
Definition: testframe.cpp:167
static bool isDead(void *memLocation)
Helper to verify a given memory location holds an already destroyed TestFrame instance.
Definition: testframe.cpp:229