SheafSystem  0.0.0.0
deep_size.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 // Implementation for deep_size functions
19 
20 #include "SheafSystem/deep_size.impl.h"
21 
22 size_t
23 sheaf::deep_size(const std::string& xp, bool xinclude_shallow)
24 {
25  size_t result;
26 
27  // Preconditions:
28 
29  // Body:
30 
31  result = xinclude_shallow ? sizeof(xp) : 0;
32 
33  //
34  // @hack This calculation is a guess and should be revisited.
35  //
36 
37  result += xp.size() * sizeof(char);
38 
39  // Postconditions:
40 
41  ensure(result >= 0);
42 
43  // Exit
44 
45  return result;
46 }
47 
SHEAF_DLL_SPEC size_t deep_size(const dof_descriptor_array &xp, bool xinclude_shallow=true)
The deep size of the referenced object of type dof_descriptor_array.