/usr/include/trilinos/Teuchos_map.hpp is in libtrilinos-dev 10.4.0.dfsg-1ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 | // @HEADER
// ***********************************************************************
//
// Teuchos: Common Tools Package
// Copyright (2004) Sandia Corporation
//
// Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
// license for use of this work by or on behalf of the U.S. Government.
//
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 2.1 of the
// License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
// USA
// Questions? Contact Michael A. Heroux (maherou@sandia.gov)
//
// ***********************************************************************
// @HEADER
#ifndef TEUCHOS_MAP_H
#define TEUCHOS_MAP_H
/*! \file Teuchos_map.hpp
\brief Provides std::map class for deficient platforms.
*/
#include "Teuchos_ConfigDefs.hpp"
/*! \class Teuchosstd::map
\brief This class creates a basic std::map object for platforms where the std::map is
deficient, otherwise the std::map is injected into the Teuchos namespace.
\note
<ol>
<li> The std::map is an integral part of Teuchos::ParameterList and Teuchos::CommandLineProcessor.
<li> Currently the basic std::map class is only used on ASCI Red (Janus).
</ol>
*/
namespace Teuchos {
#ifdef TFLOP
template<class Key, class T>
class std::map {
public:
typedef Key key_type;
typedef T mapped_type;
typedef std::pair<Key,T> value_type;
typedef std::list<value_type> list_t;
typedef typename list_t::iterator iterator;
typedef typename list_t::const_iterator const_iterator;
//! @name Constructor/Destructor.
//@{
//! Default Constructor
std::map() {}
//! Copy Constructor
std::map( const std::map<Key,T>& map_in ) : list_( map_in.list_ ) {}
//! Destructor
virtual ~std::map() {}
//@}
//! @name Accessor methods.
//@{
//! Return an iterator that points to the first pair in the std::map.
iterator begin() { return list_.begin(); }
//! Return a const iterator that points to the first pair in the std::map.
const_iterator begin() const { return list_.begin(); }
//! Return an iterator that points to the last pair in the std::map.
iterator end() { return list_.end(); }
//! Return a const iterator that points to the last pair in the std::map.
const_iterator end() const { return list_.end(); }
//! Return a reference to the mapped value that belongs to the key \c k.
/*! \param k - The key for which data should be retrieved.
If this key doesn't exist then the key is inserted into the std::map and a
reference to the mapped value is returned.
*/
mapped_type& operator[]( const key_type& k )
{
iterator itr = find(k);
if(itr != end()) return (*itr).second;
list_.push_back( value_type( k, T() ) );
return list_.back().second;
}
//@}
//! @name Search methods.
//@{
//! Locate element in the std::map with key_type \c k.
/*! \param k - The key for which an iterator should be returned.
\return An iterator that points to the element with key_type \c k, else
return end().
*/
iterator find(const key_type& k)
{
for( iterator itr = begin(); itr != end(); ++itr ) {
if( (*itr).first == k ) {
return itr;
}
}
return end();
}
//! Locate element in the std::map with key_type \c k.
/*! \param k - The key for which a constant iterator should be returned.
\return A constant iterator that points to the element with key_type \c k, else
return end().
*/
const_iterator find(const key_type& k) const
{
for( const_iterator itr = begin(); itr != end(); ++itr ) {
if( (*itr).first == k ) {
return itr;
}
}
return end();
}
bool empty() const { return list_.empty(); }
//@}
private:
list_t list_;
};
#else
using std::map;
#endif
} // namespace Teuchos
#endif // TEUCHOS_MAP_H
|