appkit  1.5.1
RoadNarrows Robotics Application Kit
Session.cxx
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////////////
2 //
3 // Package: RoadNarrows Robotics Application Tool Kit
4 //
5 // Library: librnr_appkit
6 //
7 // File: Session.cxx
8 //
9 /*! \file
10  *
11  * $LastChangedDate: 2013-05-06 10:03:14 -0600 (Mon, 06 May 2013) $
12  * $Rev: 2907 $
13  *
14  * \brief Session base class implementation.
15  *
16  * \author Robin Knight (robin.knight@roadnarrows.com)
17  * \author Daniel Packard (daniel@roadnarrows.com)
18  *
19  * \par Copyright
20  * \h_copy 2012-2017. RoadNarrows LLC.\n
21  * http://www.roadnarrows.com\n
22  * All Rights Reserved
23  */
24 /*
25  * @EulaBegin@
26  *
27  * Permission is hereby granted, without written agreement and without
28  * license or royalty fees, to use, copy, modify, and distribute this
29  * software and its documentation for any purpose, provided that
30  * (1) The above copyright notice and the following two paragraphs
31  * appear in all copies of the source code and (2) redistributions
32  * including binaries reproduces these notices in the supporting
33  * documentation. Substantial modifications to this software may be
34  * copyrighted by their authors and need not follow the licensing terms
35  * described here, provided that the new terms are clearly indicated in
36  * all files where they apply.
37  *
38  * IN NO EVENT SHALL THE AUTHOR, ROADNARROWS LLC, OR ANY MEMBERS/EMPLOYEES
39  * OF ROADNARROW LLC OR DISTRIBUTORS OF THIS SOFTWARE BE LIABLE TO ANY
40  * PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
41  * DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION,
42  * EVEN IF THE AUTHORS OR ANY OF THE ABOVE PARTIES HAVE BEEN ADVISED OF
43  * THE POSSIBILITY OF SUCH DAMAGE.
44  *
45  * THE AUTHOR AND ROADNARROWS LLC SPECIFICALLY DISCLAIM ANY WARRANTIES,
46  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
47  * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN
48  * "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE NO OBLIGATION TO
49  * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
50  *
51  * @EulaEnd@
52  */
53 ////////////////////////////////////////////////////////////////////////////////
54 
55 #include <stdarg.h>
56 
57 #include <string>
58 
59 #include "rnr/rnrconfig.h"
60 #include "rnr/log.h"
61 
62 #include "rnr/appkit/Session.h"
63 
64 using namespace std;
65 using namespace rnr;
66 
67 
68 //------------------------------------------------------------------------------
69 // Session Class
70 //------------------------------------------------------------------------------
71 
72 void Session::setError(int ecode, const char *sFmt, ...)
73 {
74  va_list ap;
75 
76  m_ecode = ecode;
77 
78  // format error message
79  va_start(ap, sFmt);
80  vsnprintf(m_bufErrorMsg, sizeof(m_bufErrorMsg), sFmt, ap);
81  m_bufErrorMsg[sizeof(m_bufErrorMsg)-1] = 0;
82  va_end(ap);
83 }
84 
85 void Session::setFatal(int ecode, const char *sFmt, ...)
86 {
87  va_list ap;
88 
89  m_ecode = ecode;
90  m_bHasFatal = true;
91 
92  // format error message
93  va_start(ap, sFmt);
94  vsnprintf(m_bufErrorMsg, sizeof(m_bufErrorMsg), sFmt, ap);
95  m_bufErrorMsg[sizeof(m_bufErrorMsg)-1] = 0;
96  va_end(ap);
97 }
Session base class.
RoadNarrows Robotics.
Definition: Camera.h:74