12 #ifndef ECL_CONTAINERS_ARRAY_NO_MEM_CHECK_HPP_ 13 #define ECL_CONTAINERS_ARRAY_NO_MEM_CHECK_HPP_ 14 #ifndef ECL_MEM_CHECK_ARRAYS 23 #include "../definitions.hpp" 24 #include "../initialiser.hpp" 25 #include "../stencil.hpp" 43 namespace blueprints {
51 namespace formatters {
53 template <
typename Type,
size_t N>
class ArrayFormatter;
105 template<
typename Type, std::
size_t Size = DynamicStorage>
188 iterator
begin() {
return elements; }
193 const_iterator
begin()
const {
return elements; }
198 iterator
end() {
return elements+Size; }
203 const_iterator
end()
const {
return elements+Size; }
208 reverse_iterator
rbegin() {
return reverse_iterator(end()); }
213 const_reverse_iterator
rbegin()
const {
return const_reverse_iterator(end()); }
218 reverse_iterator
rend() {
return reverse_iterator(begin()); }
223 const_reverse_iterator
rend()
const {
return const_reverse_iterator(begin()); }
232 reference
front() {
return elements[0]; }
237 const_reference
front()
const {
return elements[0]; }
242 reference
back() {
return elements[Size-1]; }
247 const_reference
back()
const {
return elements[Size-1]; }
340 static size_type
size() {
return Size; }
352 template <
typename OutputStream,
typename ElementType,
size_t ArraySize>
353 friend OutputStream& operator<<(OutputStream &ostream , const Array<ElementType,ArraySize> &array);
356 value_type elements[Size];
363 template <
typename OutputStream,
typename ElementType,
size_t ArraySize>
364 OutputStream& operator<<(OutputStream &ostream , const Array<ElementType,ArraySize> &array) {
369 for(
size_t i = 0; i < ArraySize; ++i )
371 ostream << array[i] <<
" ";
384 namespace blueprints {
410 template <
typename Derived>
411 class ArrayBluePrint {
425 template <
typename BaseType>
427 return static_cast<Derived*
>(
this)->instantiate();
442 template <
typename BaseType>
444 static_cast<const Derived*
>(
this)->apply(array);
457 template <
typename Type,
size_t Size>
488 std::fill_n(array.
begin(),Size,val);
496 void apply(base_type& array)
const {
497 std::fill_n(array.
begin(),Size,val);
512 template<
typename Type,
size_t Size>
Fixed size container with a few bells and whistles.
const Type * const_iterator
reference operator[](size_type i) ecl_assert_throw_decl(StandardException)
Blueprint for instantiating/configuring an array filled with a constant.
Embedded control libraries.
Parent class for array blueprints.
BluePrint factory for the Array class.
const_reverse_iterator rbegin() const
ConstantArray(const Type &value=0)
Constructor that properly configures/initialises the blueprint.
blueprints::ArrayFactory< value_type, Size > Factory
Generates blueprints for this class.
reverse_iterator rbegin()
const_reference operator[](size_type i) const ecl_assert_throw_decl(StandardException)
ecl::Array< Type, Size > base_type
Abstract representation of the class to be instantiated/configured.
BaseType implementInstantiate()
void implementApply(BaseType &array) const
std::reverse_iterator< iterator > reverse_iterator
reference at(size_type i)
std::ptrdiff_t difference_type
const_reference back() const
const_reverse_iterator rend() const
#define ecl_assert_throw(expression, exception)
const Type & const_reference
base_type instantiate()
Instantiate a copy of the object that is blueprinted.
const_reference at(size_type i) const
void apply(base_type &array) const
Stencil< Array< Type, Size > > stencil(const unsigned int &start_index, const unsigned int &n) ecl_assert_throw_decl(StandardException)
Open a window (stencil) onto the array.
std::reverse_iterator< const_iterator > const_reverse_iterator
const_reference front() const
Convenience initialiser with bounds checking for fixed size containers.
const_iterator end() const
#define ecl_assert_throw_decl(exception)
A safe windowing class that opens onto array-like containers.
#define ecl_compile_time_concept_check(Model)
static ConstantArray< Type, Size > Constant(const Type &value)
OutputStream & operator<<(OutputStream &ostream, Format< std::string > &formatter) ecl_assert_throw_decl(StandardException)
virtual ~ArrayBluePrint()
Array(const blueprints::ArrayBluePrint< T > &blueprint)
Blueprint constructor.
const_iterator begin() const
formatters::ArrayFormatter< Type, Size > Formatter
Formatter for this class.