*** empty log message ***

This commit is contained in:
David Rose 2001-05-02 22:53:32 +00:00
parent ae14b2870a
commit 8d91ab13fe
2 changed files with 180 additions and 9 deletions

View File

@ -3,7 +3,148 @@
//
////////////////////////////////////////////////////////////////////
#include <indent.h>
////////////////////////////////////////////////////////////////////
// Function: EggMorphList::Constructor
// Access: Public
// Description:
////////////////////////////////////////////////////////////////////
template<class MorphType>
INLINE EggMorphList<MorphType>::
EggMorphList() {
}
////////////////////////////////////////////////////////////////////
// Function: EggMorphList::Copy Constructor
// Access: Public
// Description:
////////////////////////////////////////////////////////////////////
template<class MorphType>
INLINE EggMorphList<MorphType>::
EggMorphList(const EggMorphList<MorphType> &copy) :
_morphs(copy._morphs)
{
}
////////////////////////////////////////////////////////////////////
// Function: EggMorphList::Copy Assignment Operator
// Access: Public
// Description:
////////////////////////////////////////////////////////////////////
template<class MorphType>
INLINE void EggMorphList<MorphType>::
operator = (const EggMorphList &copy) {
_morphs = copy._morphs;
}
////////////////////////////////////////////////////////////////////
// Function: EggMorphList::Destructor
// Access: Public
// Description:
////////////////////////////////////////////////////////////////////
template<class MorphType>
INLINE EggMorphList<MorphType>::
~EggMorphList() {
}
////////////////////////////////////////////////////////////////////
// Function: EggMorphList::operator ==
// Access: Public
// Description:
////////////////////////////////////////////////////////////////////
template<class MorphType>
INLINE bool EggMorphList<MorphType>::
operator == (const EggMorphList<MorphType> &other) const {
return (_morphs == other._morphs);
}
////////////////////////////////////////////////////////////////////
// Function: EggMorphList::operator !=
// Access: Public
// Description:
////////////////////////////////////////////////////////////////////
template<class MorphType>
INLINE bool EggMorphList<MorphType>::
operator != (const EggMorphList<MorphType> &other) const {
return (_morphs != other._morphs);
}
////////////////////////////////////////////////////////////////////
// Function: EggMorphList::operator <
// Access: Public
// Description:
////////////////////////////////////////////////////////////////////
template<class MorphType>
INLINE bool EggMorphList<MorphType>::
operator < (const EggMorphList<MorphType> &other) const {
return (_morphs < other._morphs);
}
////////////////////////////////////////////////////////////////////
// Function: EggMorphList::begin
// Access: Public
// Description:
////////////////////////////////////////////////////////////////////
template<class MorphType>
INLINE EggMorphList<MorphType>::iterator EggMorphList<MorphType>::
begin() {
return _morphs.begin();
}
////////////////////////////////////////////////////////////////////
// Function: EggMorphList::begin
// Access: Public
// Description:
////////////////////////////////////////////////////////////////////
template<class MorphType>
INLINE EggMorphList<MorphType>::const_iterator EggMorphList<MorphType>::
begin() const {
return _morphs.begin();
}
////////////////////////////////////////////////////////////////////
// Function: EggMorphList::end
// Access: Public
// Description:
////////////////////////////////////////////////////////////////////
template<class MorphType>
INLINE EggMorphList<MorphType>::iterator EggMorphList<MorphType>::
end() {
return _morphs.end();
}
////////////////////////////////////////////////////////////////////
// Function: EggMorphList::end
// Access: Public
// Description:
////////////////////////////////////////////////////////////////////
template<class MorphType>
INLINE EggMorphList<MorphType>::const_iterator EggMorphList<MorphType>::
end() const {
return _morphs.end();
}
////////////////////////////////////////////////////////////////////
// Function: EggMorphList::size
// Access: Public
// Description:
////////////////////////////////////////////////////////////////////
template<class MorphType>
INLINE EggMorphList<MorphType>::size_type EggMorphList<MorphType>::
size() const {
return _morphs.size();
}
////////////////////////////////////////////////////////////////////
// Function: EggMorphList::empty
// Access: Public
// Description:
////////////////////////////////////////////////////////////////////
template<class MorphType>
INLINE bool EggMorphList<MorphType>::
empty() const {
return _morphs.empty();
}
////////////////////////////////////////////////////////////////////
// Function: EggMorphList::insert
@ -20,19 +161,19 @@ template<class MorphType>
pair<EggMorphList<MorphType>::iterator, bool> EggMorphList<MorphType>::
insert(const MorphType &value) {
pair<iterator, bool> result;
iterator i;
for (i = begin(); i != end(); ++i) {
if ((*i) == value) {
Morphs::iterator mi;
for (mi = _morphs.begin(); mi != _morphs.end(); ++mi) {
if ((*mi) == value) {
// This value is already present.
result.first = i;
result.first = mi;
result.second = false;
return result;
}
}
// This value is not already present; add it to the list.
push_back(value);
result.first = begin() + size() - 1;
_morphs.push_back(value);
result.first = _morphs.begin() + _morphs.size() - 1;
result.second = true;
return result;
}

View File

@ -10,6 +10,8 @@
#include "eggMorph.h"
#include <indent.h>
#include <vector>
////////////////////////////////////////////////////////////////////
@ -17,10 +19,38 @@
// Description : A collection of <Dxyz>'s or <Duv>'s or some such.
////////////////////////////////////////////////////////////////////
template<class MorphType>
class EggMorphList : public vector<MorphType> {
class EggMorphList {
private:
typedef vector<MorphType> Morphs;
public:
pair<EggMorphList<MorphType>::iterator, bool> insert(const MorphType &value);
typedef Morphs::iterator iterator;
typedef Morphs::const_iterator const_iterator;
typedef Morphs::size_type size_type;
INLINE EggMorphList();
INLINE EggMorphList(const EggMorphList<MorphType> &copy);
INLINE void operator = (const EggMorphList<MorphType> &copy);
INLINE ~EggMorphList();
INLINE bool operator == (const EggMorphList<MorphType> &other) const;
INLINE bool operator != (const EggMorphList<MorphType> &other) const;
INLINE bool operator < (const EggMorphList<MorphType> &other) const;
INLINE iterator begin();
INLINE const_iterator begin() const;
INLINE iterator end();
INLINE const_iterator end() const;
INLINE size_type size() const;
INLINE bool empty() const;
pair<iterator, bool> insert(const MorphType &value);
void write(ostream &out, int indent_level) const;
private:
Morphs _morphs;
};