cti.builder
index
/home/miyabe/workspaces/copper_drivers/cti.python/src/code/cti/builder.py

$Id: builder.py 932 2013-05-31 05:28:13Z miyabe $

 
Modules
       
tempfile

 
Classes
       
builtins.object
Fragment
NullBuilder
StreamBuilder
FileBuilder

 
class FileBuilder(StreamBuilder)
    FileBuilder(file)
 
ファイルに対して結果を構築するオブジェクトです。
 
 
Method resolution order:
FileBuilder
StreamBuilder
builtins.object

Methods defined here:
__init__(self, file)
結果構築オブジェクトを作成します。
 
file: 結果ファイル
finish(self)
serial_write(self, data)

Methods inherited from StreamBuilder:
add_block(self)
block_write(self, id, data)
close_block(self, id)
dispose(self)
insert_block_before(self, anchor_id)

Data descriptors inherited from StreamBuilder:
__dict__
dictionary for instance variables
__weakref__
list of weak references to the object

 
class Fragment(builtins.object)
    Fragment(id)
 

 
  Methods defined here:
__init__(self, id)
Initialize self.  See help(type(self)) for accurate signature.
flush(self, tempFile, out)
フラグメントの内容を吐き出して、フラグメントを破棄します。
 
tempFile: 一時ファイル
out: 出力先ストリーム( IO )
write(self, tempFile, onMemory, segment, bytes)
フラグメントにデータを書き込みます。
 
tempFile: 一時ファイル
onMemory: メモリ上に置かれたデータの合計サイズ
segment: セグメント番号シーケンス
bytes: データ
 
戻り値: 書き込んだバイト数

Data descriptors defined here:
__dict__
dictionary for instance variables
__weakref__
list of weak references to the object

 
class NullBuilder(builtins.object)
    このオブジェクトは結果を構築しません。
 
  Methods defined here:
add_block(self)
block_write(self, id, data)
close_block(self, id)
dispose(self)
finish(self)
insert_block_before(self, anchor_id)
serial_write(self, data)

Data descriptors defined here:
__dict__
dictionary for instance variables
__weakref__
list of weak references to the object

 
class StreamBuilder(builtins.object)
    StreamBuilder(out, finish_func=None)
 
ストリームに対して結果を構築するオブジェクトです。
 
  Methods defined here:
__init__(self, out, finish_func=None)
結果構築オブジェクトを作成します。
 
out: 出力先ストリーム
finish_func: 結果を実際に出力する前に呼び出されるコールバック関数。引数として結果のバイト数が渡されます
 
例:
def content_type(opts):
    print("Content-Type: "+opts['mime_type'])
def content_length(length):
    print("Content-Length: "+str(length))
    print()
results = SingleResult(StreamBuilder(sys.stdout, content_length), content_type)
add_block(self)
block_write(self, id, data)
close_block(self, id)
dispose(self)
finish(self)
insert_block_before(self, anchor_id)
serial_write(self, data)

Data descriptors defined here:
__dict__
dictionary for instance variables
__weakref__
list of weak references to the object

 
Data
        FRG_MEM_SIZE = 256
ON_MEMORY = 1048576
SEGMENT_SIZE = 8192