BlockIt
blockit::library::Library Class Reference
Inheritance diagram for blockit::library::Library:
Collaboration diagram for blockit::library::Library:

List of all members.

Public Member Functions

def __init__
def __getitem__
def __setitem__
def close
def open
def keys
def name
def fromFile
def unpackTree
def get
def pop
def genKey
def __iadd__

Static Public Attributes

string VERSION = '1.1'

Private Member Functions

def _upgradeLib

Private Attributes

 _name
 _blockDict
 _metadata
 _lib

Detailed Description

This is a class which acts as a library to store/retrieve pre-parsed
blocks.  It uses the Python shelve module for peristent storage.  It will
also have the ability to store instantiated templates correlated with
their parent file.

Definition at line 42 of file library.py.


Constructor & Destructor Documentation

def blockit::library::Library::__init__ (   self,
  name,
  blockList 
)
Library constructor

Input
-----
name : library file name
blockList : list of block types for use with library.  This is needed
    for block reconstruction.

Reimplemented in blockit::Fortran::library::FortranLibrary.

Definition at line 52 of file library.py.


Member Function Documentation

def blockit::library::Library::__getitem__ (   self,
  name 
)
Return an item from the library.

Definition at line 71 of file library.py.

def blockit::library::Library::__iadd__ (   self,
  other 
)
Add contents of another library into this library using unary add,
i.e. self += other.  

Reimplemented in blockit::Fortran::library::FortranLibrary.

Definition at line 248 of file library.py.

def blockit::library::Library::__setitem__ (   self,
  name,
  item 
)
Store an item in the library.  The item must be serializable.

Definition at line 77 of file library.py.

def blockit::library::Library::_upgradeLib (   self) [private]
Function called when a library version number is less than the the
current codes version number for the library.

Reimplemented in blockit::Fortran::library::FortranLibrary.

Definition at line 241 of file library.py.

def blockit::library::Library::close (   self)
Close the database to make sure it is current.

Definition at line 83 of file library.py.

def blockit::library::Library::fromFile (   self,
  name,
  hsh = None 
)
Read a block from a pickled block file.  This will restore everything
necessary to for the block and all its children which was written
using the blocks toFile method.

Input
-----
name : block fileName to read from
hsh : a hash to compare file hash with.  If the same, then pickle file is
      read, else None is returned.

Definition at line 164 of file library.py.

def blockit::library::Library::genKey (   blk)
Static method to generate a library key from an object that has
a fileName() or name() and hash() method.

Input
-----
blk : object with a fileName() or name() and hash() method. fileName()
      is tried first, then name().

Reimplemented in blockit::Fortran::library::FortranLibrary.

Definition at line 223 of file library.py.

def blockit::library::Library::get (   self,
  item,
  default 
)

Definition at line 209 of file library.py.

def blockit::library::Library::keys (   self)
Wrapper to return the database keys.

Definition at line 152 of file library.py.

def blockit::library::Library::name (   self)

Definition at line 161 of file library.py.

def blockit::library::Library::open (   self)
Open the database.

Definition at line 95 of file library.py.

def blockit::library::Library::pop (   self,
  item 
)

Definition at line 216 of file library.py.

def blockit::library::Library::unpackTree (   self,
  tree 
)
Unpack a dictionary tree of blocks and return parent block.

Definition at line 186 of file library.py.


Member Data Documentation

Definition at line 60 of file library.py.

Definition at line 60 of file library.py.

Definition at line 60 of file library.py.

Definition at line 60 of file library.py.

string blockit::library::Library::VERSION = '1.1' [static]

Reimplemented in blockit::Fortran::library::FortranLibrary.

Definition at line 50 of file library.py.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Properties