Move C structures wrappers from core.hpp to core_c.h

Also move RTTIImpl class to the only usage
This commit is contained in:
Andrey Kamaev
2013-03-26 18:44:18 +04:00
parent 6bf49d49e7
commit 19f8f85c51
4 changed files with 423 additions and 418 deletions

View File

@@ -4097,139 +4097,6 @@ public:
size_t remaining;
};
////////////// convenient wrappers for operating old-style dynamic structures //////////////
template<typename _Tp> class SeqIterator;
typedef Ptr<CvMemStorage> MemStorage;
/*!
Template Sequence Class derived from CvSeq
The class provides more convenient access to sequence elements,
STL-style operations and iterators.
\note The class is targeted for simple data types,
i.e. no constructors or destructors
are called for the sequence elements.
*/
template<typename _Tp> class CV_EXPORTS Seq
{
public:
typedef SeqIterator<_Tp> iterator;
typedef SeqIterator<_Tp> const_iterator;
//! the default constructor
Seq();
//! the constructor for wrapping CvSeq structure. The real element type in CvSeq should match _Tp.
Seq(const CvSeq* seq);
//! creates the empty sequence that resides in the specified storage
Seq(MemStorage& storage, int headerSize = sizeof(CvSeq));
//! returns read-write reference to the specified element
_Tp& operator [](int idx);
//! returns read-only reference to the specified element
const _Tp& operator[](int idx) const;
//! returns iterator pointing to the beginning of the sequence
SeqIterator<_Tp> begin() const;
//! returns iterator pointing to the element following the last sequence element
SeqIterator<_Tp> end() const;
//! returns the number of elements in the sequence
size_t size() const;
//! returns the type of sequence elements (CV_8UC1 ... CV_64FC(CV_CN_MAX) ...)
int type() const;
//! returns the depth of sequence elements (CV_8U ... CV_64F)
int depth() const;
//! returns the number of channels in each sequence element
int channels() const;
//! returns the size of each sequence element
size_t elemSize() const;
//! returns index of the specified sequence element
size_t index(const _Tp& elem) const;
//! appends the specified element to the end of the sequence
void push_back(const _Tp& elem);
//! appends the specified element to the front of the sequence
void push_front(const _Tp& elem);
//! appends zero or more elements to the end of the sequence
void push_back(const _Tp* elems, size_t count);
//! appends zero or more elements to the front of the sequence
void push_front(const _Tp* elems, size_t count);
//! inserts the specified element to the specified position
void insert(int idx, const _Tp& elem);
//! inserts zero or more elements to the specified position
void insert(int idx, const _Tp* elems, size_t count);
//! removes element at the specified position
void remove(int idx);
//! removes the specified subsequence
void remove(const Range& r);
//! returns reference to the first sequence element
_Tp& front();
//! returns read-only reference to the first sequence element
const _Tp& front() const;
//! returns reference to the last sequence element
_Tp& back();
//! returns read-only reference to the last sequence element
const _Tp& back() const;
//! returns true iff the sequence contains no elements
bool empty() const;
//! removes all the elements from the sequence
void clear();
//! removes the first element from the sequence
void pop_front();
//! removes the last element from the sequence
void pop_back();
//! removes zero or more elements from the beginning of the sequence
void pop_front(_Tp* elems, size_t count);
//! removes zero or more elements from the end of the sequence
void pop_back(_Tp* elems, size_t count);
//! copies the whole sequence or the sequence slice to the specified vector
void copyTo(std::vector<_Tp>& vec, const Range& range=Range::all()) const;
//! returns the vector containing all the sequence elements
operator std::vector<_Tp>() const;
CvSeq* seq;
};
/*!
STL-style Sequence Iterator inherited from the CvSeqReader structure
*/
template<typename _Tp> class CV_EXPORTS SeqIterator : public CvSeqReader
{
public:
//! the default constructor
SeqIterator();
//! the constructor setting the iterator to the beginning or to the end of the sequence
SeqIterator(const Seq<_Tp>& seq, bool seekEnd=false);
//! positions the iterator within the sequence
void seek(size_t pos);
//! reports the current iterator position
size_t tell() const;
//! returns reference to the current sequence element
_Tp& operator *();
//! returns read-only reference to the current sequence element
const _Tp& operator *() const;
//! moves iterator to the next sequence element
SeqIterator& operator ++();
//! moves iterator to the next sequence element
SeqIterator operator ++(int) const;
//! moves iterator to the previous sequence element
SeqIterator& operator --();
//! moves iterator to the previous sequence element
SeqIterator operator --(int) const;
//! moves iterator forward by the specified offset (possibly negative)
SeqIterator& operator +=(int);
//! moves iterator backward by the specified offset (possibly negative)
SeqIterator& operator -=(int);
// this is index of the current element module seq->total*2
// (to distinguish between 0 and seq->total)
int index;
};
class CV_EXPORTS Algorithm;
class CV_EXPORTS AlgorithmInfo;
struct CV_EXPORTS AlgorithmInfoData;