Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

appbus_t Class Reference

#import <appbus_t.h>

Inheritance diagram for appbus_t:

Object < ciroucset_user_interface_utils_p > List of all members.

Public Member Functions

(id) init
(id) free
(void) add_record:
(record_t *) record_by_name:
(int) number_of_records
(record_t *) record_by_index:
(int) save_record_to_db::
(int) fetch_record_from_db::
(int) delete_record_in_db::
(void) find_largest_keys_for_record::
(void) unlock_record_in_db:
(maybe_tlock_record_in_db:
(long) new_recid::
(maybe_tfind_keys_for_record::
(int) script_exec::::
(int) wait_for_input:
(void) announce_to_user:
(maybe_task_yesno_question:
(void) set_ui_widgetor:
(void) sendmsgtoall::::
(void) sendmsg::
(maybe_tfind_allowed_value:::::

Static Public Member Functions

(id) init_with_values::

Public Attributes

char * DBNAME
char * DBUSERNAME
char * DBPASSWORD
char * DBSERVERNAME

Protected Attributes

pointerlist_trecs
tcl_ttcl_wrapper
net_tnet
db_tdb
id< ciroucset_user_interface_utils_pui_widgets

Detailed Description

a data structure meant to be global, owns rest of the stuff, at least records, database object and maybe script interpreter ; idea is that this bus may be of any lenght.


Member Function Documentation

- (void) add_record: (record_t *)  aRec  
 

method for adding a record, usually called from kortpartser.y

Parameters:
aRec is a brand new record, already constructed
Returns:
none

- (void) announce_to_user: (wchar_t *)  aMsg  
 

widget like method for saying something to user in visual way

Reimplemented from < ciroucset_user_interface_utils_p >.

- (maybe_t) ask_yesno_question: (wchar_t *)  aMsg  
 

widget like method for asking a yes/no question

Reimplemented from < ciroucset_user_interface_utils_p >.

- (int) delete_record_in_db: (id< valuepair_p > *)  values
: (id< record_status_p >)  recstat
 
 

removes record to db

Parameters:
values is list values for database record
recstat is record status structure
Returns:
0 in success, something else otherwise

- (int) fetch_record_from_db: (id< valuepair_p > *)  values
: (id< record_status_p >)  recstat
 
 

gets record to db

Parameters:
values is list values for database record
recstat is record status structure
Returns:
0 in success, something else otherwise

- (maybe_t) find_allowed_value: (id< record_status_p >)  aRecStat
: (id< valuepair_p >)  aValue
: (wchar_t *)  aCurrentValue
: (char *)  aAllowedValuesTable
: (char *)  aAllowedValuesColumn
 
 

method for finding out if current value is among allowed ones and if not, helping user in choosing one. note that user has no other possibility but to choose one :-)

Parameters:
aRecStat is status of the record where aValue belongs to
aValue is the value (form field) whose value we're seeking
aCurrentValue is aValue as wchar_t fetched from field
aAllowedValuesTable is db table where list of allowed values is found
aAllowedValuesColumn is db column where list of allowed values is found
Returns:
returns yes when a full screen update is in order

- (maybe_t) find_keys_for_record: (id< valuepair_p > *)  values
: (id< record_status_p >)  recstat
 
 

with a little help from db side finds keys for a record returns yes on success.

- (void) find_largest_keys_for_record: (id< valuepair_p > *)  values
: (id< record_status_p >)  recstat
 
 

invents surrogate keys for a record not yet fetched

Parameters:
values is list values for database record
recstat is record status structure
Returns:
none

- (id) free  
 

frees allocated memory

- (id) init  
 

default initializer

+ (id) init_with_values: (char *)  argv0
: (char *)  dbservername
 
 

actual initializer

Parameters:
argv0 is our executable name
dbservername is name of the host where db server should be found
Returns:
returns a bus.

- (maybe_t) lock_record_in_db: (id< record_status_p >)  recstat  
 

locks a record in db from others to use

Parameters:
recstat is record status structure
Returns:
yes if locking did succeed

- (long) new_recid: (id< valuepair_p > *)  values
: (id< record_status_p >)  recstat
 
 

returns unique long for tab/col pair

Parameters:
values is list values for database record
recstat is record status structure
Returns:
none

- (int) number_of_records  
 

method that returns number of records that this bus knows about

Returns:
number of records

- (record_t *) record_by_index: (int)  aIndex  
 

method that returns a record based on its index number. records are numbered from 0-n.

Parameters:
aIndex is the index number for a recored
Returns:
nil or record by the index.

- (record_t *) record_by_name: (char *)  aRecName  
 

method that returns record by its name

Parameters:
aRecName is the name, in us7ascii
Returns:
nil or record

- (int) save_record_to_db: (id< valuepair_p > *)  values
: (id< record_status_p >)  recstat
 
 

saves record to db

Parameters:
values is list values for database record
recstat is record status structure
Returns:
0 in success, something else otherwise

- (int) script_exec: (char *)  script
: (id< valuepair_p > *)  values
: (id< record_status_p >)  recstat
: (char *)  aNetMsg
 
 

scripting support method

- (void) sendmsg: (char *)  message
: (wchar_t *)  recipient_addr
 
 

method for sending a message to one recipient.

Parameters:
message content of the message, UTF-8 preferred
recipient_addr network addr of the recipient, like host:port
Returns:
none

- (void) sendmsgtoall: (char *)  message
: (char *)  recname
: (long)  recid
: (long)  recid_master
 
 

method for sending a message to other instances of this program.

Parameters:
message is pointer to the message. it max len depends on message transport in use. if UDP is used, then it is less than udp packet size in underlying network conf.
recname if non-NULL only ui:s registered to this record name will receive the message.
recid if non- -01 only ui:s registered to this recid will receive the message. This is evaluated only if recname is non-NULL.
recid_master same meaning as with recid but for recid_master.
Returns:
none

- (void) set_ui_widgetor: (id< ciroucset_user_interface_utils_p >)  aWidgetter  
 

setter for pointer of implementor of ciroucset_user_interface_utils_p

Parameters:
aWidgetter pointer of class implementing ciroucset_user_interface_utils_p

- (void) unlock_record_in_db: (id< record_status_p >)  recstat  
 

unlocks a record in db for others to use

Parameters:
recstat is record status structure
Returns:
none

- (int) wait_for_input: (char **)  aNetMsgPtr  
 

method for sitting in select() system call checking where the input is coming from. if network message is received during wait, aNetMsgPtr gets assigned a value pointing to content of the message. If that happens, caller is responsible for freeing the buf pointed by aNetMsgPtr ; when this method is called aNetMsgPtr must point to pointer pointing to NULL.


Member Data Documentation

- (db_t*) db [protected]
 

db_t may be used to semi-permanently save things

- (char*) DBNAME
 

these public DB thingies are set by database connection

- (net_t*) net [protected]
 

how to reach others:

- (pointerlist_t*) recs [protected]
 

here are record definition structure pointers:

- (tcl_t*) tcl_wrapper [protected]
 

tcl_wrapper is scripting support:

- (id<ciroucset_user_interface_utils_p>) ui_widgets [protected]
 

class that actually implements ciroucset_user_interface_utils_p


The documentation for this class was generated from the following file:
Generated on Sun May 15 23:45:23 2005 for kort4 by  doxygen 1.4.2