SheafSystem  0.0.0.0
fiber_bundles_read.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 
19 
20 #include "SheafSystem/base_space_poset.h"
21 
22 #ifdef _WIN32
23 #include "SheafSystem/io.h"
24 #endif
25 
26 #include "SheafSystem/namespace_poset.h"
27 #include "SheafSystem/poset_handle_factory.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 fiber_bundle;
36 
37 string filename;
38 
39 int
40 main(int argc, char** argv)
41 {
42  if (argc > 1)
43  {
44  // test for existence of file
45  // if the filename is not valid, then exit 0 with warning message
46 
47  if (access(argv[1],0) == 0)
48  {
49  filename = argv[1];
50  }
51  else
52  {
53  cout << "warning: no such filename " << argv[1] << "\n";
54  exit(0);
55  }
56  }
57  else
58  {
59  cerr << "usage: fiber_bundles_read sheaf_file [enable_error_report]\n";
60  exit(0);
61  }
62 
64 
66 
67  // Make the default namespace
68 
69  namespace_poset ns("test");
70 
71  // Read the namespace from the file;
72  // need write access in order to read it.
73 
75  storage_agent sa(filename, sheaf_file::READ_ONLY, false);
76  sa.put_member_record_buffer_ub(15);
77  sa.put_dof_tuple_record_buffer_ub(15);
78  sa.read_entire(ns);
79 
80  // Output a text version to stdout
81 
82  cout << ns << endl;
83 
84  return 0;
85 }
The default name space; a poset which contains other posets as members.
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...
static void initialize_prototypes()
Initialize all the prototypes needed by various factory methods,.
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