Skip to content

Commit e6da69c

Browse files
committed
types
1 parent 993d597 commit e6da69c

2 files changed

Lines changed: 43 additions & 19 deletions

File tree

src/cllazyfile/lazyInstMgr.h

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,19 +37,25 @@ class lazyInstMgr {
3737
// */
3838
// instancesLazy_t instancesLazy;
3939

40-
/** map from instance number to beginning and end positions in the stream
40+
/** map from instance number to beginning and end positions and the data section
4141
* \sa instanceStreamPosMap_pair
4242
*/
4343
instanceStreamPosMap_t instanceStreamPosMap;
4444

45+
dataSectionReaderVec_t dataSections;
46+
47+
lazyFileReaderVec_t files;
48+
4549
public:
46-
void addSchema( void (*initFn) ());
47-
void addFile( std::string fname );
50+
void addSchema( void (*initFn) () ); //?
51+
void openFile( std::string fname ) {
52+
files.push_back( new lazyFileReader( fname, dataSections, instanceStreamPosMap ) );
53+
}
4854
// what about the registry?
4955

5056
// addInstance(lazyInstance l, lazyFileReader* r); ///< only used by lazy file reader functions
51-
void addLazyInstance(streamRange range, lazyDataSectionReader* r );
52-
void addDataSection(lazyDataSectionReader* d, lazyFileReader* f); ///< only used by lazy file reader functions
57+
void addLazyInstance( lazyInstance range, lazyDataSectionReader* r );
58+
void addDataSection( lazyDataSectionReader* d, lazyFileReader* f ); ///< only used by lazy file reader functions
5359
};
5460

5561
#endif //LAZYINSTMGR_H

src/cllazyfile/lazyTypes.h

Lines changed: 32 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,47 @@
33

44
#include <map>
55
#include <iostream>
6-
#include "sdaiApplication_instance.h"
7-
8-
typedef long instanceID;
9-
10-
//FIXME need to include sectionReader* in below type
11-
// typedef std::pair< std::streampos, std::streampos > streamRange;
12-
13-
// typedefs for instanceRefMMap, instanceTypeMMap, instancesLoaded, instanceStreamPosMap
6+
// #include "sdaiApplication_instance.h"
7+
8+
class SDAI_Application_instance;
9+
class sectionReader;
10+
class lazyFileReader;
11+
12+
typedef long instanceID; ///< the number assigned to an instance in the file
13+
typedef int sectionID; ///< the index of a sectionReader in a sectionReaderVec_t
14+
15+
/** This struct contains all the information necessary to locate an instance. It is primarily
16+
* for instances that are present in a file but not memory. It could be useful in other
17+
* situations, so the information should be kept up-to-date.
18+
*/
19+
typedef struct {
20+
std::streampos begin, end;
21+
sectionID section;
22+
/* bool modified; */ /* this will be useful when writing instances - if an instance is
23+
unmodified, simply copy it from the input file to the output file */
24+
} lazyInstance;
25+
26+
// instanceRefMMap - multimap between an instanceID and instances that refer to it
1427
typedef std::multimap< instanceID, instanceID > instanceRefMMap_t;
1528
typedef std::pair< instanceID, instanceID > instanceRefMMap_pair;
1629
typedef std::pair< instanceRefMMap_t::iterator, instanceRefMMap_t::iterator > instanceRefMMap_range;
30+
31+
// instanceTypeMMap - multimap from instance type to instanceID's
1732
typedef std::multimap< std::string, instanceID > instanceTypeMMap_t;
1833
typedef std::pair< std::string, instanceID > instanceTypeMMap_pair;
1934
typedef std::pair< instanceTypeMMap_t::iterator, instanceTypeMMap_t::iterator > instanceTypeMMap_range;
35+
36+
// instancesLoaded - fully created instances
2037
typedef std::map< instanceID, SDAI_Application_instance * > instancesLoaded_t;
2138
typedef std::pair< instanceID, SDAI_Application_instance * > instancesLoaded_pair;
22-
typedef std::map< instanceID, streamRange > instanceStreamPosMap_t;
23-
typedef std::pair< instanceID, streamRange > instanceStreamPosMap_pair;
24-
25-
// typedef std::map< instanceID, lazyInstance * > instancesLazy_t;
26-
// typedef std::pair< instanceID, lazyInstance * > instancesLazy_pair;
2739

40+
// instanceStreamPosMap - map instance id to a range in a particular file
41+
typedef std::map< instanceID, lazyInstance > instanceStreamPosMap_t;
42+
typedef std::pair< instanceID, lazyInstance > instanceStreamPosMap_pair;
2843

44+
// data sections
45+
typedef std::vector< sectionReader * > dataSectionReaderVec_t;
2946

47+
typedef std::vector< lazyFileReader * > lazyFileReaderVec_t;
3048

31-
#endif //LAZYTYPES_H
49+
#endif //LAZYTYPES_H

0 commit comments

Comments
 (0)