Commit 83caa7b1 authored by Matthias Möller's avatar Matthias Möller
Browse files

remove "using namespace" in template files -> header files

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@14957 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 5c5f4b28
......@@ -43,9 +43,7 @@
#define FRAMEANIMATIONT_C
#include <vector>
#include <assert.h>
using namespace std;
#include <cassert>
//-----------------------------------------------------------------------------
......@@ -112,7 +110,7 @@ FrameAnimationT<PointT>::FrameAnimationT(const FrameAnimationT<PointT> &_other)
AnimationT<PointT>(),
skeleton_(_other.skeleton_)
{
for(typename vector<Pose*>::const_iterator it = _other.poses_.begin(); it != _other.poses_.end(); ++it)
for(typename std::vector<Pose*>::const_iterator it = _other.poses_.begin(); it != _other.poses_.end(); ++it)
poses_.push_back(new Pose(**it));
}
......@@ -124,7 +122,7 @@ FrameAnimationT<PointT>::FrameAnimationT(const FrameAnimationT<PointT> &_other)
template<class PointT>
FrameAnimationT<PointT>::~FrameAnimationT()
{
for(typename vector<Pose*>::iterator it = poses_.begin(); it != poses_.end(); ++it)
for(typename std::vector<Pose*>::iterator it = poses_.begin(); it != poses_.end(); ++it)
delete *it;
poses_.clear();
}
......@@ -195,7 +193,7 @@ void FrameAnimationT<PointT>::setFrameCount(unsigned int _frames)
template<class PointT>
void FrameAnimationT<PointT>::insertJointAt(unsigned int _index)
{
for(typename vector<Pose*>::iterator it = poses_.begin(); it != poses_.end(); ++it)
for(typename std::vector<Pose*>::iterator it = poses_.begin(); it != poses_.end(); ++it)
(*it)->insertJointAt(_index);
}
......@@ -211,7 +209,7 @@ void FrameAnimationT<PointT>::insertJointAt(unsigned int _index)
template<class PointT>
void FrameAnimationT<PointT>::removeJointAt(unsigned int _index)
{
for(typename vector<Pose*>::iterator it = poses_.begin(); it != poses_.end(); ++it)
for(typename std::vector<Pose*>::iterator it = poses_.begin(); it != poses_.end(); ++it)
(*it)->removeJointAt(_index);
}
......@@ -227,7 +225,7 @@ void FrameAnimationT<PointT>::removeJointAt(unsigned int _index)
template<class PointT>
void FrameAnimationT<PointT>::updateFromGlobal(unsigned int _index)
{
for(typename vector<Pose*>::iterator it = poses_.begin(); it != poses_.end(); ++it)
for(typename std::vector<Pose*>::iterator it = poses_.begin(); it != poses_.end(); ++it)
(*it)->updateFromGlobal(_index);
}
......
......@@ -45,11 +45,8 @@
#include "AnimationT.hh"
#include <vector>
#include <assert.h>
#include <math.h>
using namespace std;
#include <cassert>
#include <cmath>
//-----------------------------------------------------------------------------------------------------
/**
......
......@@ -43,9 +43,8 @@
#define JOINTT_C
#include "JointT.hh"
#include <assert.h>
using namespace std;
#include <cassert>
#include <algorithm>
//-----------------------------------------------------------------------------------------------------
......@@ -133,7 +132,7 @@ inline void JointT<PointT>::setParent(Joint *_newParent, SkeletonT<PointT> &_ske
}
if(parent_ != 0)
if(remove(parent_->children_.begin(), parent_->children_.end(), this) != parent_->children_.end()) // remove from the last parent
if(std::remove(parent_->children_.begin(), parent_->children_.end(), this) != parent_->children_.end()) // remove from the last parent
parent_->children_.resize(parent_->children_.size() - 1);
parent_ = _newParent;
......
......@@ -42,10 +42,10 @@
#define PROPERTIES_C
#include <assert.h>
#include <cassert>
#include <utility>
#include <iostream>
using namespace std;
//-----------------------------------------------------------------------------
......@@ -70,7 +70,7 @@ bool Properties::add_property(PropertyHandleT<T> &_hProp, std::string _name)
// create it if not
// find the first free entry
vector<BaseProperty*>::iterator it;
std::vector<BaseProperty*>::iterator it;
for(it = properties_.begin(); it != properties_.end(); ++it)
if(*it == 0)
break;
......@@ -79,12 +79,12 @@ bool Properties::add_property(PropertyHandleT<T> &_hProp, std::string _name)
{
// append at the end
_hProp.idx_ = properties_.size();
property_names_.insert( pair<string, int>(_name, properties_.size()) );
property_names_.insert( std::pair<std::string, int>(_name, properties_.size()) );
properties_.push_back(dynamic_cast<BaseProperty*>(new PropertyT<T>(size_))); // the new one needs to have the same number of entries, to keep the correspondence
}else{
// insert in the free spot
_hProp.idx_ = it - properties_.begin();
property_names_.insert( pair<string, int>(_name, _hProp.idx_) );
property_names_.insert( std::pair<std::string, int>(_name, _hProp.idx_) );
*it = new PropertyT<T>(size_);
}
return true;
......@@ -106,7 +106,7 @@ template<typename T>
bool Properties::get_property(PropertyHandleT<T> &_hProp, std::string _name)
{
// find the name
map<string, int>::iterator f = property_names_.find(_name);
std::map<std::string, int>::iterator f = property_names_.find(_name);
if(f == property_names_.end())
return false;
......@@ -139,7 +139,7 @@ bool Properties::remove_property(PropertyHandleT<T> &_hProp)
properties_[_hProp.idx_] = 0;
// find the names entry and delete it
for(map<string, int>::iterator it = property_names_.begin(); it != property_names_.end(); ++it)
for(std::map<std::string, int>::iterator it = property_names_.begin(); it != property_names_.end(); ++it)
{
if(it->second == _hProp.idx_)
{
......
......@@ -59,7 +59,6 @@
#include <deque>
//== NAMESPACES ===============================================================
using namespace std;
namespace ACG {
namespace SceneGraph {
......
......@@ -52,13 +52,12 @@
#include <iostream>
#include <algorithm>
#include <utility>
#include "SkeletonT.hh"
#include "Animation/FrameAnimationT.hh"
using namespace std;
//-----------------------------------------------------------------------------
// ITERATOR - IMPLEMENTATION
......@@ -385,14 +384,14 @@ SkeletonT<PointT>::SkeletonT(const SkeletonT<PointT> &_other) :
referencePose_(this)
{
// create a copy of the joints, not yet linked because they refer to each other using pointers
for(typename vector<Joint*>::const_iterator it = _other.joints_.begin(); it != _other.joints_.end(); ++it)
for(typename std::vector<Joint*>::const_iterator it = _other.joints_.begin(); it != _other.joints_.end(); ++it)
{
joints_.push_back(new Joint(**it));
insert_property_at( (*it)->id() );
}
// construct the links
for(typename vector<Joint*>::const_iterator it = _other.joints_.begin(); it != _other.joints_.end(); ++it)
for(typename std::vector<Joint*>::const_iterator it = _other.joints_.begin(); it != _other.joints_.end(); ++it)
{
Joint *pJoint = *it;
......@@ -406,7 +405,7 @@ SkeletonT<PointT>::SkeletonT(const SkeletonT<PointT> &_other) :
names_.insert(_other.names_.begin(), _other.names_.end());
for(typename vector<Animation*>::const_iterator it = _other.animations_.begin(); it != _other.animations_.end(); ++it)
for(typename std::vector<Animation*>::const_iterator it = _other.animations_.begin(); it != _other.animations_.end(); ++it)
if (*it) {
animations_.push_back((**it).copy());
}
......@@ -430,13 +429,13 @@ SkeletonT<PointT>& SkeletonT<PointT>::operator= (const SkeletonT<PointT>& _other
clear();
// create a copy of the joints, not yet linked because they refer to each other using pointers
for(typename vector<Joint*>::const_iterator it = _other.joints_.begin(); it != _other.joints_.end(); ++it){
for(typename std::vector<Joint*>::const_iterator it = _other.joints_.begin(); it != _other.joints_.end(); ++it){
joints_.push_back(new Joint(**it));
insert_property_at( (*it)->id() );
}
// construct the links
for(typename vector<Joint*>::const_iterator it = _other.joints_.begin(); it != _other.joints_.end(); ++it){
for(typename std::vector<Joint*>::const_iterator it = _other.joints_.begin(); it != _other.joints_.end(); ++it){
Joint *pJoint = *it;
if(pJoint->parent() != 0)
......@@ -450,7 +449,7 @@ SkeletonT<PointT>& SkeletonT<PointT>::operator= (const SkeletonT<PointT>& _other
names_.insert(_other.names_.begin(), _other.names_.end());
for(typename vector<Animation*>::const_iterator it = _other.animations_.begin(); it != _other.animations_.end(); ++it)
for(typename std::vector<Animation*>::const_iterator it = _other.animations_.begin(); it != _other.animations_.end(); ++it)
if (*it)
animations_.push_back((**it).copy());
......@@ -510,7 +509,7 @@ void SkeletonT<PointT>::addJoint(typename SkeletonT<PointT>::Joint *_pParent, ty
insert_property_at(newJointID);
referencePose_.insertJointAt(newJointID);
for(typename vector<Animation*>::iterator it = animations_.begin(); it != animations_.end(); ++it)
for(typename std::vector<Animation*>::iterator it = animations_.begin(); it != animations_.end(); ++it)
if (*it)
(*it)->insertJointAt(newJointID);
......@@ -540,7 +539,7 @@ void SkeletonT<PointT>::removeJoint(typename SkeletonT<PointT>::Joint *_pJoint)
remove_property_at(_pJoint->id());
referencePose_.removeJointAt(_pJoint->id());
for(typename vector<Animation*>::iterator it = animations_.begin(); it != animations_.end(); ++it)
for(typename std::vector<Animation*>::iterator it = animations_.begin(); it != animations_.end(); ++it)
if (*it) (*it)->removeJointAt(_pJoint->id());
// Reattach the deleted joint's children to the joint's parent
......@@ -564,7 +563,7 @@ void SkeletonT<PointT>::removeJoint(typename SkeletonT<PointT>::Joint *_pJoint)
_pJoint->parent_->children_.push_back(*c_it);
}
if(remove(_pJoint->parent_->children_.begin(), _pJoint->parent_->children_.end(), _pJoint) != _pJoint->parent_->children_.end()) // remove the joint from its parent
if(std::remove(_pJoint->parent_->children_.begin(), _pJoint->parent_->children_.end(), _pJoint) != _pJoint->parent_->children_.end()) // remove the joint from its parent
_pJoint->parent_->children_.resize(_pJoint->parent_->children_.size() - 1);
}
......@@ -769,7 +768,7 @@ template<typename PointT>
AnimationHandle SkeletonT<PointT>::addAnimation(std::string _name, Animation *_animation)
{
// try to find an unused animation slot first
typename vector<Animation*>::iterator f;
typename std::vector<Animation*>::iterator f;
for(f = animations_.begin(); f != animations_.end(); ++f)
if(*f == 0)
break;
......@@ -777,11 +776,11 @@ AnimationHandle SkeletonT<PointT>::addAnimation(std::string _name, Animation *_a
if(f == animations_.end())
{
// all in use, append
names_.insert( pair<string, unsigned int>(_name, animations_.size()) );
names_.insert( std::pair<std::string, unsigned int>(_name, animations_.size()) );
animations_.push_back(_animation);
}else{
// found an empty one, use it
names_.insert( pair<string, unsigned int>(_name, f - animations_.begin()) );
names_.insert( std::pair<std::string, unsigned int>(_name, f - animations_.begin()) );
*f = _animation;
}
......@@ -803,7 +802,7 @@ template<typename PointT>
AnimationHandle SkeletonT<PointT>::cloneAnimation(std::string _name, const AnimationHandle &_hAni)
{
// try to find an unused animation slot first
typename vector<Animation*>::iterator f;
typename std::vector<Animation*>::iterator f;
for(f = animations_.begin(); f != animations_.end(); ++f)
if(*f == 0)
break;
......@@ -811,14 +810,14 @@ AnimationHandle SkeletonT<PointT>::cloneAnimation(std::string _name, const Anima
if(f == animations_.end())
{
// all in use, append
names_.insert( pair<string, unsigned int>(_name, animations_.size()) );
names_.insert( std::pair<std::string, unsigned int>(_name, animations_.size()) );
if(animation(_hAni) != 0)
animations_.push_back((*animation(_hAni)).copy());
else
animations_.push_back(new FrameAnimationT<Point>(referencePose_));
}else{
// found an empty one, use it
names_.insert( pair<string, unsigned int>(_name, f - animations_.begin()) );
names_.insert( std::pair<std::string, unsigned int>(_name, f - animations_.begin()) );
if(animation(_hAni) != 0)
*f = (*animation(_hAni)).copy();
else
......@@ -836,7 +835,7 @@ AnimationHandle SkeletonT<PointT>::cloneAnimation(std::string _name, const Anima
template<typename PointT>
AnimationHandle SkeletonT<PointT>::animationHandle(std::string _name)
{
map<string, unsigned int>::iterator f = names_.find(_name);
std::map<std::string, unsigned int>::iterator f = names_.find(_name);
if(f == names_.end())
return AnimationHandle();
......@@ -851,7 +850,7 @@ AnimationHandle SkeletonT<PointT>::animationHandle(std::string _name)
template<typename PointT>
typename SkeletonT<PointT>::Animation *SkeletonT<PointT>::animation(std::string _name)
{
map<string, unsigned int>::iterator f = names_.find(_name);
std::map<std::string, unsigned int>::iterator f = names_.find(_name);
if(f == names_.end())
return 0;
......@@ -880,7 +879,7 @@ template<typename PointT>
void SkeletonT<PointT>::removeAnimation(std::string _name)
{
// get an iterator for the animation
map<string, unsigned int>::iterator f = names_.find(_name);
std::map<std::string, unsigned int>::iterator f = names_.find(_name);
if(f == names_.end())
return;
......@@ -904,7 +903,7 @@ void SkeletonT<PointT>::removeAnimation(const AnimationHandle &_hAni)
animations_[_hAni.animationIndex()] = 0;
// remove the name entry
for(map<string, unsigned int>::iterator it = names_.begin(); it != names_.end(); ++it)
for(typename std::map<std::string, unsigned int>::iterator it = names_.begin(); it != names_.end(); ++it)
{
if(it->second == _hAni.animationIndex())
{
......@@ -924,7 +923,7 @@ void SkeletonT<PointT>::clearAnimations()
{
names_.clear();
for(typename vector<Animation*>::iterator it = animations_.begin(); it != animations_.end(); ++it)
for(typename std::vector<Animation*>::iterator it = animations_.begin(); it != animations_.end(); ++it)
delete *it;
animations_.clear();
}
......@@ -978,7 +977,7 @@ template<typename PointT>
const std::string &SkeletonT<PointT>::animationName(unsigned int _index)
{
unsigned int i = 0;
map<string, unsigned int>::iterator pos = names_.begin();
std::map<std::string, unsigned int>::iterator pos = names_.begin();
while(pos->second != _index && pos != names_.end())
{
......@@ -1000,7 +999,7 @@ template<typename PointT>
void SkeletonT<PointT>::updateFromGlobal(unsigned int _idJoint)
{
referencePose_.updateFromGlobal(_idJoint);
for(typename vector<Animation*>::iterator it = animations_.begin(); it != animations_.end(); ++it) {
for(typename std::vector<Animation*>::iterator it = animations_.begin(); it != animations_.end(); ++it) {
if (*it)
(*it)->updateFromGlobal(_idJoint);
}
......@@ -1039,7 +1038,7 @@ void SkeletonT<PointT>::insertJoint(typename SkeletonT<PointT>::Joint *_pChild,
insert_property_at(childID);
referencePose_.insertJointAt(childID);
for(typename vector<Animation*>::iterator it = animations_.begin(); it != animations_.end(); ++it)
for(typename std::vector<Animation*>::iterator it = animations_.begin(); it != animations_.end(); ++it)
if (*it)
(*it)->insertJointAt(childID);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment