ToolTalk User's Guide

Scoping to a Session Only

The type TT_SESSION scopes to a session only. Static session-scoped patterns require an explicit tt_session_join call to set the scope value; dynamic session-scoped patterns can be set with either the tt_session_join call or the tt_pattern_session_add call.


Note –

The session specified by these calls must be the default session.


Example 3–1 shows a static session-scoped pattern; Example 3–2 shows a dynamic session-scoped pattern.


Example 3–1 Static Session-Scoped Pattern

Obtain procid  

tt_open();  

Ptype is scoped to session 

tt_ptype_declare(ptype);  

Join session 

tt_session_join(tt_default_session()); 



Example 3–2 Dynamic Session-Scoped Pattern with a File Attribute

Obtain procid 

tt_open();  

Create pattern  

Tt_pattern pat = tt_create_pattern();  

Add scope to pattern 

tt_pattern_scope_add(pat, TT_SESSION);  

Add session to pattern  

tt_pattern_session_add (tt_default_session()); 

Register pattern 

tt_pattern_register(pat);