/usr/include/givaro/givarray0.h is in libgivaro-dev 3.7.2-1.
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 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 | // ==========================================================================
// $Source: /var/lib/cvs/Givaro/src/kernel/bstruct/givarray0.h,v $
// Copyright(c)'1994-2009 by The Givaro group
// This file is part of Givaro.
// Givaro is governed by the CeCILL-B license under French law
// and abiding by the rules of distribution of free software.
// see the COPYRIGHT file for more details.
// Author: T. Gautier
// $Id: givarray0.h,v 1.7 2011-02-02 16:23:55 bboyer Exp $
// ==========================================================================
//
/*! @file givarray0.h
* @brief Array of type T with reference mecanism.
*/
#ifndef __GIVARO_array0_H
#define __GIVARO_array0_H
#include <stddef.h> // size_t
#include "givaro/givaromm.h"
#include "givaro/givperf.h"
#include "givaro/giverror.h"
namespace Givaro {
#ifndef DOXYGEN_SHOULD_SKIP_THIS
GIVARO_PERF_DEFCLASS(Array0,T)
#else
//! defined by marco GIVARO_PERF_DEFCLASS. ref counting and stuff.
template<class T>
struct _perfArray0<T> {};
#endif
/** @class Array0
* NODOC
*/
template <class T>
class Array0
#ifndef DOXYGEN_SHOULD_SKIP_THIS
GIVARO_PERF_INEHERIT(Array0,T)
#else
: public _perfArray0<T>
#endif
{
/** @internal
* build...?
*/
void build( size_t s, const T& t) ;
public :
typedef int Indice_t;
typedef T Type_t;
typedef Array0<T> Self_t;
typedef Type_t *Iterator_t;
typedef const Type_t *constIterator_t;
//! STL compliance
//@{
typedef Type_t value_type;
typedef Type_t *iterator;
typedef const Type_t *const_iterator;
//@}
//! Default cstor : ctsor of s size array
//@{
Array0 (size_t s = 0);
Array0 (size_t s, const T& t);
//@}
//! Recopy cstor : logical copy
Array0 (const Self_t& p, givNoCopy);
//! Recopy cstor : physical copy
Array0 (const Self_t& p, givWithCopy);
//! Destructor
~Array0 ();
//! Destroy of the array
void destroy ();
/** Allocation of an array of s Elements.
* if refcount>1
* then it is always a creation of new array
*/
void allocate (size_t s);
/** Reallocation of an array of s Elements.
* if refcount>1
* then it is always a creation of new array + recopy
*/
void reallocate (size_t s);
//! resize
void resize (size_t s) { this->reallocate(s); }
//! reserve
void reserve (size_t s) { this->reallocate(s); this->reallocate(0); }
/** Physical copy operator.
*reallocate dest of the same size
* as src (if necessary) and apply GivaroCopyItem<Array<T>,T> on each Element.
* This class can be specialized. Return dest (i.e, *this).
*/
Self_t& copy(const Self_t& src);
//! Logical recopy operator: make an alias to src. Return dest.
Self_t& logcopy(const Self_t& src);
//! assignement operator is physical copy
Self_t& operator= (const Self_t& p);
//! Return the occuped size of the array
size_t size() const { return _size; }
//! Return the physical size of the array (capacity)
size_t phsize() const;
//! Return the base ptr to the array
//@{
Type_t* baseptr();
const Type_t* baseptr() const;
//@}
//! Access to the ith Element:
//@{
const T& operator[] (Indice_t i) const; // { return _d[i]; }
T& operator[] (Indice_t i); // { return _d[i]; } ;
//@}
//! back/front
//@{
const T& front () const; // { return _d[0]; }
T& front (); // { return _d[0]; } ;
const T& back () const; // *(--end())
T& back (); // *(--end())
//@}
//! add one element at the end
void push_back( const T& a );
//!write
void write(Indice_t i, const Type_t& val);
//! read
void read (Indice_t i, Type_t& val) const;
//! Iterators
//@{
Iterator_t begin();
Iterator_t end();
constIterator_t begin() const;
constIterator_t end() const;
//@}
//! @internal
//! get Counter
int getCounter() const
{
return *_cnt ;
}
protected :
//--------------------- protected Internal representation
int* _cnt; //!< reference counter on _d
size_t _size; //!< actual size of the array. If ==0 then _psz=_d=_cnt=0
size_t _psz; //!< physical size of the array
T* _d; //!< ptr to the memory
};
} // namespace Givaro
#include "givaro/givarray0.inl"
#endif // __GIVARO_array0_H
/* -*- mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
// vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s:syntax=cpp.doxygen
|