Scopira  20080306
output.h
1 
2 /*
3  * Copyright (c) 2004-2008 National Research Council
4  *
5  * All rights reserved.
6  *
7  * This material is confidential and proprietary information of
8  * National Research Council Canada ("Confidential Information").
9  * This Confidential Information may only be used and reproduced
10  * in accordance with the terms of the license agreement.
11  *
12  */
13 
14 #ifndef __INCLUDED_SCOPIRA_TOOL_OUTPUT_H__
15 #define __INCLUDED_SCOPIRA_TOOL_OUTPUT_H__
16 
17 // we'll include this as a convinience to users that include output.h
18 #include <scopira/tool/flow.h>
19 #include <scopira/tool/export.h>
20 
21 namespace scopira
22 {
23  namespace tool
24  {
29  typedef scopira::tool::oflow_i& (*output_func)(void);
30 
43  SCOPIRA_EXPORT extern scopira::tool::output_func gm_tool_output;
44 
55 
64  SCOPIRA_EXPORT extern scopira::tool::oflow_i *gm_tool_output_stream;
65 
66  class output_stack;
67  }
68 }
69 
70 #ifndef OUTPUT
71 #define OUTPUT (scopira::tool::gm_tool_output())
72 #endif
73 
81 {
82  private:
83  output_func dm_oldfunc;
84  oflow_i *dm_oldflow;
85  public:
93  : dm_oldfunc(gm_tool_output), dm_oldflow(gm_tool_output_stream) {
95  gm_tool_output_stream = newflow;
96  }
97 
105  : dm_oldfunc(gm_tool_output), dm_oldflow(gm_tool_output_stream) {
106  gm_tool_output = newfunc;
108  }
109 
110  // dtor does a stack pop, that is, restores the old values
111  ~output_stack() {
112  gm_tool_output = dm_oldfunc;
113  gm_tool_output_stream = dm_oldflow;
114  }
115 };
116 
137 #endif
138 
scopira::tool::oflow_i * gm_tool_output_stream
output_stack(output_func newfunc)
Definition: output.h:104
Definition: archiveflow.h:20
output_stack(oflow_i *newflow)
Definition: output.h:92
scopira::tool::output_func gm_tool_output
scopira::tool::oflow_i &(* output_func)(void)
Definition: output.h:29
scopira::tool::oflow_i & tool_output(void)
Definition: output.h:80
Definition: flow.h:159