SheafSystem  0.0.0.0
dumpsheaf.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 #include "SheafSystem/base_space_poset.h"
20 
21 #ifdef _WIN32
22 #include "io.h"
23 #endif
24 
25 #include "SheafSystem/namespace_poset.h"
26 #include "SheafSystem/poset_handle_factory.h"
27 #include "SheafSystem/std_fstream.h"
28 #include "SheafSystem/std_iostream.h"
29 #include "SheafSystem/storage_agent.h"
30 
32 
33 #include "SheafSystem/fiber_bundles_namespace.h"
34 
35 using namespace std;
36 using namespace fiber_bundle;
37 
38 string filename;
39 
40 int
41 main(int argc, char** argv)
42 {
43  if (argc > 1)
44  {
45  // test for existence of file
46  // if the filename is not valid, then exit 0 with warning message
47 
48  ifstream ltest(argv[1]);
49  if (ltest.is_open())
50  {
51  filename = argv[1];
52  ltest.close();
53  }
54  else
55  {
56  cout << "warning: no such filename " << argv[1] << "\n";
57  exit(0);
58  }
59  }
60  else
61  {
62  cerr << "usage: dumpsheaf sheaf_file [enable_error_report]\n";
63  exit(0);
64  }
65 
67 
68  fiber_bundles_namespace::initialize_prototypes();
69 
70  // Make the default namespace
71 
72  namespace_poset ns("test");
73 
74  // Read the namespace from the file;
75  // need write access in order to read it.
76 
78  storage_agent sa(filename, sheaf_file::READ_ONLY, false);
79  sa.put_member_record_buffer_ub(15);
80  sa.put_dof_tuple_record_buffer_ub(15);
81  sa.read_entire(ns);
82 
83  // Output a text version to stdout
84 
85  cout << ns << endl;
86 
87  return 0;
88 }
The default name space; a poset which contains other posets as members.
STL namespace.
virtual void get_read_write_access(bool xrelease_read_only_access=false)
Get read write access to the state associated with this. If release_read_only_access is requested...
Namespace for the fiber_bundles component of the sheaf system.
Agent responsible for importing and exporting posets from an external name space which resides on dis...
Definition: storage_agent.h:74