/* * AtomSet_impl.hpp * * Created on: Jul 8, 2010 * Author: crueger */ #ifndef OBSERVEDCONTAINER_IMPL_HPP_ #define OBSERVEDCONTAINER_IMPL_HPP_ #include "Patterns/ObservedContainer.hpp" template inline ObservedContainer::ObservedContainer(Observable* _obs) : obs(_obs) {} template inline ObservedContainer::ObservedContainer(const ObservedContainer &src) : content(src.content), obs(src.obs) {} template inline ObservedContainer::~ObservedContainer() {} template inline ObservedContainer& ObservedContainer::operator=(const ObservedContainer &rhs){ content=rhs.content; return *this; } template inline typename ObservedContainer::iterator ObservedContainer::begin(){ return ObservedContainer::iterator(content.begin(),obs); } template inline typename ObservedContainer::const_iterator ObservedContainer::begin() const{ return content.begin(); } template inline typename ObservedContainer::iterator ObservedContainer::end(){ return ObservedContainer::iterator(content.end(),obs); } template inline typename ObservedContainer::const_iterator ObservedContainer::end() const{ return content.end(); } template inline typename ObservedContainer::reverse_iterator ObservedContainer::rbegin(){ return reverse_iterator(begin()); } template inline typename ObservedContainer::const_reverse_iterator ObservedContainer::rbegin() const{ return const_reverse_iterator(begin()); } template inline typename ObservedContainer::reverse_iterator ObservedContainer::rend(){ return reverse_iterator(end()); } template inline typename ObservedContainer::const_reverse_iterator ObservedContainer::rend() const{ return const_reverse_iterator(end()); } template inline bool ObservedContainer::empty() const{ return content.empty(); } template inline size_t ObservedContainer::size() const{ return content.size(); } template inline size_t ObservedContainer::max_size() const{ return content.max_size(); } template inline typename ObservedContainer::mapped_type & ObservedContainer::operator[](const key_type &key){ return content[key]; } template inline std::pair::iterator,bool> ObservedContainer::insert (const value_type &value){ std::pair res = content.insert(value); return std::make_pair(iterator(res.first,obs),res.second); } template inline size_t ObservedContainer::erase ( const key_type& x ){ return content.erase(x); } template inline void ObservedContainer::clear(){ content.clear(); } template inline typename ObservedContainer::iterator ObservedContainer::find ( const key_type& x ){ return iterator(content.find(x),obs); } template inline typename ObservedContainer::const_iterator ObservedContainer::find ( const key_type& x ) const{ return content.find(x); } template inline size_t ObservedContainer::count ( const key_type& x ) const{ return content.count(x); } /************ Unprotected access ***************/ template inline typename ObservedContainer::internal_iterator ObservedContainer::begin_internal(){ return content.begin(); } template inline typename ObservedContainer::internal_iterator ObservedContainer::end_internal(){ return content.end(); } template inline typename ObservedContainer::reverse_internal_iterator ObservedContainer::rbegin_internal(){ return content.rbegin(); } template inline typename ObservedContainer::reverse_internal_iterator ObservedContainer::rend_internal(){ return content.rend(); } template inline typename ObservedContainer::set_t & ObservedContainer::getContent(){ return content; } /************ Explicit instantiation ***************/ #define CONSTRUCT_OBSERVEDCONTAINER(name) \ template ObservedContainer< name >& ObservedContainer< name >::operator=(const ObservedContainer< name >&); \ template ObservedContainer< name >::iterator ObservedContainer< name >::begin(); \ template ObservedContainer< name >::const_iterator ObservedContainer< name >::begin() const; \ template ObservedContainer< name >::iterator ObservedContainer< name >::end(); \ template ObservedContainer< name >::const_iterator ObservedContainer< name >::end() const; \ template ObservedContainer< name >::reverse_iterator ObservedContainer< name >::rbegin(); \ template ObservedContainer< name >::const_reverse_iterator ObservedContainer< name >::rbegin() const; \ template ObservedContainer< name >::reverse_iterator ObservedContainer< name >::rend(); \ template ObservedContainer< name >::const_reverse_iterator ObservedContainer< name >::rend() const; \ template bool ObservedContainer< name >::empty() const; \ template size_t ObservedContainer< name >::size() const; \ template size_t ObservedContainer< name >::max_size() const; \ template ObservedContainer< name >::mapped_type &ObservedContainer< name >::operator[](const key_type&); \ template std::pair::iterator,bool> ObservedContainer< name >::insert (const value_type&); \ template size_t ObservedContainer< name >::erase ( const key_type& x ); \ template void ObservedContainer< name >::clear(); \ template ObservedContainer< name >::iterator ObservedContainer< name >::find ( const key_type& x ); \ template ObservedContainer< name >::const_iterator ObservedContainer< name >::find ( const key_type& x ) const; \ template size_t ObservedContainer< name >::count ( const key_type& x ) const; \ template ObservedContainer< name >::internal_iterator ObservedContainer< name >::begin_internal(); \ template ObservedContainer< name >::reverse_internal_iterator ObservedContainer< name >::rbegin_internal(); \ template ObservedContainer< name >::internal_iterator ObservedContainer< name >::end_internal(); \ template ObservedContainer< name >::reverse_internal_iterator ObservedContainer< name >::rend_internal(); \ #endif /* OBSERVEDCONTAINER_IMPL_HPP_ */