torc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
FrameSet.hpp
Go to the documentation of this file.
1 // Torc - Copyright 2011-2013 University of Southern California. All Rights Reserved.
2 // $HeadURL$
3 // $Id$
4 
5 // This program is free software: you can redistribute it and/or modify it under the terms of the
6 // GNU General Public License as published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
10 // without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
11 // the GNU General Public License for more details.
12 //
13 // You should have received a copy of the GNU General Public License along with this program. If
14 // not, see <http://www.gnu.org/licenses/>.
15 
16 /// \file
17 /// \brief Header for the FrameSet class.
18 
19 #ifndef TORC_BITSTREAM_FRAMESET_HPP
20 #define TORC_BITSTREAM_FRAMESET_HPP
21 
22 #include "torc/bitstream/Frame.hpp"
25 
26 namespace torc {
27 namespace bitstream {
28 
29  class VirtexFrameAddress;
30  /// \brief Set of contiguous frames.
31  template <class FRAME_TYPE> class FrameSet
32  : public std::vector<boost::shared_ptr<FRAME_TYPE> > {
33  protected:
34  // typedefs
35  /// \brief Imported type name.
36  typedef boost::uint32_t uint32_t;
37  public:
38  // typedefs
39  /// \brief FrameSet frame type.
40  typedef FRAME_TYPE frame_t;
41  /// \brief FrameSet word type.
42  typedef typename FRAME_TYPE::word_t word_t;
43  /// \brief Shared pointer encapsulation of a Frame.
44  typedef boost::shared_ptr<FRAME_TYPE> FrameSharedPtr;
45  /// \brief Shared pointer for frame addressing.
46  typedef boost::shared_ptr<VirtexFrameAddress> VirtexFarSharedPtr;
47  /// \brief Word shared array for frame words
48  typedef boost::shared_array<uint32_t> WordSharedArray;
49  // constructors
50  /// \brief Null constructor.
51  FrameSet(void) {}
52  /// \brief Basic constructor for full bitstream.
53  /// \var inFrameLength The default length of each frame in the set.
54  /// \var inFrameCount The number of frames in the set.
55  FrameSet(uint32_t inFrameLength, uint32_t inFrameCount) {
56  for(uint32_t i = 0; i < inFrameCount; i++)
57  this->push_back(FrameSharedPtr(new FRAME_TYPE(inFrameLength)));
58  }
59  /// \brief Basic constructor for partial bitstream.
60  /// \var inFrameLength The default length of each frame in the set.
61  /// \var inFrameCount The number of frames in the set.
62  /// \var inWords The frame words
63  /// \var inFar Address of the frames in the set
64  FrameSet(uint32_t inFrameLength, uint32_t inFrameCount, WordSharedArray inWords,
65  VirtexFrameAddress& inFar) {
66  VirtexFarSharedPtr farPtr = inFar;
67  for(uint32_t i = 0; i < inFrameCount; i++)
68  this->push_back(FrameSharedPtr(new FRAME_TYPE(inFrameLength,
69  &inWords[i*inFrameLength])));
70  }
71  };
72 
73  typedef FrameSet<VirtexFrame> VirtexFrameSet; ///< \brief Virtex frame set type.
74  typedef FrameSet<SpartanFrame> SpartanFrameSet; ///< \brief Spartan frame set type.
75  typedef FrameSet<Spartan6Frame> Spartan6FrameSet; ///< \brief Spartan6 frame set type.
76 
77  /// \brief Set of contiguous frames for each of the eight possible block types.
78  template <typename FRAME_TYPE> class FrameBlocks {
79  protected:
80  public:
81  // typedefs
82  /// \brief FrameSet frame type.
83  typedef FRAME_TYPE frame_t;
84  /// \brief FrameSet word type.
85  typedef typename FRAME_TYPE::word_t word_t;
86  // members
87  /// \brief FrameSets for each of the eight block types.
89  };
90 
91  typedef FrameBlocks<VirtexFrame> VirtexFrameBlocks; ///< \brief Virtex frame blocks type.
92  typedef FrameBlocks<SpartanFrame> SpartanFrameBlocks; ///< \brief Spartan frame blocks type.
93  typedef FrameBlocks<Spartan6Frame> Spartan6FrameBlocks; ///< \brief Spartan6 frame blocks type.
94 
95 } // namespace bitstream
96 } // namespace torc
97 
98 #endif // TORC_BITSTREAM_FRAMESET_HPP
FRAME_TYPE frame_t
FrameSet frame type.
Definition: FrameSet.hpp:40
FrameBlocks< SpartanFrame > SpartanFrameBlocks
Spartan frame blocks type.
Definition: FrameSet.hpp:92
Set of contiguous frames for each of the eight possible block types.
Definition: FrameSet.hpp:78
FrameSet< VirtexFrame > VirtexFrameSet
Virtex frame set type.
Definition: FrameSet.hpp:73
Header for the Frame class.
FrameBlocks< Spartan6Frame > Spartan6FrameBlocks
Spartan6 frame blocks type.
Definition: FrameSet.hpp:93
boost::shared_array< uint32_t > WordSharedArray
Word shared array for frame words.
Definition: FrameSet.hpp:48
Virtex Frame Address base-class.
FRAME_TYPE::word_t word_t
FrameSet word type.
Definition: FrameSet.hpp:85
FrameSet< FRAME_TYPE > mBlock[Bitstream::eBlockTypeCount]
FrameSets for each of the eight block types.
Definition: FrameSet.hpp:88
Header for the Bitstream class.
boost::shared_ptr< FRAME_TYPE > FrameSharedPtr
Shared pointer encapsulation of a Frame.
Definition: FrameSet.hpp:44
FrameSet(uint32_t inFrameLength, uint32_t inFrameCount)
Definition: FrameSet.hpp:55
boost::shared_ptr< VirtexFrameAddress > VirtexFarSharedPtr
Shared pointer for frame addressing.
Definition: FrameSet.hpp:46
boost::uint32_t uint32_t
Imported type name.
Definition: FrameSet.hpp:36
FrameSet< SpartanFrame > SpartanFrameSet
Spartan frame set type.
Definition: FrameSet.hpp:74
FRAME_TYPE::word_t word_t
FrameSet word type.
Definition: FrameSet.hpp:42
FrameSet(uint32_t inFrameLength, uint32_t inFrameCount, WordSharedArray inWords, VirtexFrameAddress &inFar)
Definition: FrameSet.hpp:64
FRAME_TYPE frame_t
FrameSet frame type.
Definition: FrameSet.hpp:83
FrameBlocks< VirtexFrame > VirtexFrameBlocks
Virtex frame blocks type.
Definition: FrameSet.hpp:91
FrameSet< Spartan6Frame > Spartan6FrameSet
Spartan6 frame set type.
Definition: FrameSet.hpp:75
Header for the VirtexBitstream class.
Set of contiguous frames.
Definition: FrameSet.hpp:31
FrameSet(void)
Null constructor.
Definition: FrameSet.hpp:51