ToolTalk User's Guide

File-based Scoping in Patterns

Table 8-2 describes the types of scopes that use files which you can use to scope messages with patterns.

Table 8-2 Scoping a Message with Patterns to a File

Type of Scope 

Description 

TT_FILE

Scopes to the specified file only. You can set a session attribute on this type of pattern to provide a file-in-session-like scoping but a tt_session_join call will not update the session attribute of a pattern that is scoped to TT_FILE.

TT_BOTH

Scopes to the union of interest in the file and the session. A pattern with only this scope will match messages that are scoped to the file, or scoped to the session, or scoped to both the file and the session.

TT_FILE_IN_SESSION

Scopes to the intersection of interest in the file and the session. A pattern with only this scope will only match messages that are scoped to both the file and session.

To scope to the union of TT_FILE_IN_SESSION and TT_SESSION, add both scopes to the same pattern, as shown in Example 8-1.


Example 8-1 Scoping to Union of TT_FILE_IN_SESSION and TT_SESSION

	tt_open();

	Tt_pattern pat = tt_create_pattern();
	tt_pattern_scope_add(pat, TT_FILE_IN_SESSION);
	tt_pattern_scope_add(pat, TT_SESSION);
	tt_pattern_file_add(pat, file);
	tt_pattern_session_add(pat, tt_default_session());
	tt_pattern_register(pat);