SheafSystem  0.0.0.0
auto_block.cc
1 
2 //
3 // Copyright (c) 2014 Limit Point Systems, Inc.
4 //
5 // Licensed under the Apache License, Version 2.0 (the "License");
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 // http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17 
18 
19 // Implementation for class auto_block.
20 
21 #include "SheafSystem/auto_block.impl.h"
22 
23 using namespace std;
24 
25 // ===========================================================
26 // INVALID_BLOCK_INITIALIZATION_POLICY SPECIALIZATIONS
27 // ===========================================================
28 
29 // float
30 
31 float
33 invalid()
34 {
35  static const float result =
36  numeric_limits<float>::has_quiet_NaN ?
37  numeric_limits<float>::quiet_NaN() :
38  numeric_limits<float>::max();
39 
40  return result;
41 }
42 
43 void
45 initialize(float* xbegin, float* xend)
46 {
47  for(float* i=xbegin; i<xend; ++i)
48  {
49  *i = invalid();
50  }
51 }
52 
53 void
55 initialize(float& xvalue)
56 {
57  xvalue = invalid();
58 }
59 
60 // double
61 
62 double
64 invalid()
65 {
66  static const double result =
67  numeric_limits<double>::has_quiet_NaN ?
68  numeric_limits<double>::quiet_NaN() :
69  numeric_limits<double>::max();
70 
71  return result;
72 }
73 
74 void
76 initialize(double* xbegin, double* xend)
77 {
78  for(double* i=xbegin; i<xend; ++i)
79  {
80  *i = invalid();
81  }
82 }
83 
84 void
86 initialize(double& xvalue)
87 {
88  xvalue = invalid();
89 }
90 
static void initialize(T *xbegin, T *xend)
Initializes the range [xbegin, xend) to invalid().
STL namespace.
A auto_block initialization policy that initializes the values to invalid.
Definition: auto_block.h:61
SHEAF_DLL_SPEC void max(const vd &x0, vd_value_type &xresult, bool xauto_access)
Maximum component of x0, pre-allocated version.
Definition: vd.cc:2097