/[svn]/linuxsampler/trunk/src/common/optional.h
ViewVC logotype

Diff of /linuxsampler/trunk/src/common/optional.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 879 by schoenebeck, Tue Nov 22 11:49:40 2005 UTC revision 880 by schoenebeck, Tue Jun 27 22:57:37 2006 UTC
# Line 3  Line 3 
3   *   LinuxSampler - modular, streaming capable sampler                     *   *   LinuxSampler - modular, streaming capable sampler                     *
4   *                                                                         *   *                                                                         *
5   *   Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck   *   *   Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck   *
6   *   Copyright (C) 2005 Christian Schoenebeck                              *   *   Copyright (C) 2005, 2006 Christian Schoenebeck                        *
7   *                                                                         *   *                                                                         *
8   *   This program is free software; you can redistribute it and/or modify  *   *   This program is free software; you can redistribute it and/or modify  *
9   *   it under the terms of the GNU General Public License as published by  *   *   it under the terms of the GNU General Public License as published by  *
# Line 24  Line 24 
24  #ifndef __LS_OPTIONAL_H__  #ifndef __LS_OPTIONAL_H__
25  #define __LS_OPTIONAL_H__  #define __LS_OPTIONAL_H__
26    
27  #include "LinuxSamplerException.h"  #include "Exception.h"
28    
29  namespace LinuxSampler {  namespace LinuxSampler {
30    
# Line 57  namespace LinuxSampler { Line 57  namespace LinuxSampler {
57                  initialized = true;                  initialized = true;
58              }              }
59    
60              const T& get() const throw (LinuxSamplerException) {              const T& get() const throw (Exception) {
61                  if (!initialized) throw LinuxSamplerException("optional variable not initialized");                  if (!initialized) throw Exception("optional variable not initialized");
62                  return data;                  return data;
63              }              }
64    
65              T& get() throw (LinuxSamplerException) {              T& get() throw (Exception) {
66                  if (!initialized) throw LinuxSamplerException("optional variable not initialized");                  if (!initialized) throw Exception("optional variable not initialized");
67                  return data;                  return data;
68              }              }
69    
70              optional& operator =(const optional& arg) throw (LinuxSamplerException) {              optional& operator =(const optional& arg) throw (Exception) {
71                  if (!arg.initialized) throw LinuxSamplerException("optional variable not initialized");                  if (!arg.initialized) throw Exception("optional variable not initialized");
72                  this->data  = arg.data;                  this->data  = arg.data;
73                  initialized = true;                  initialized = true;
74                  return *this;                  return *this;
# Line 80  namespace LinuxSampler { Line 80  namespace LinuxSampler {
80                  return *this;                  return *this;
81              }              }
82    
83              const T& operator *() const throw (LinuxSamplerException) { return get(); }              const T& operator *() const throw (Exception) { return get(); }
84              T&       operator *()       throw (LinuxSamplerException) { return get(); }              T&       operator *()       throw (Exception) { return get(); }
85    
86              const T* operator ->() const throw (LinuxSamplerException) {              const T* operator ->() const throw (Exception) {
87                  if (!initialized) throw LinuxSamplerException("optional variable not initialized");                  if (!initialized) throw Exception("optional variable not initialized");
88                  return &data;                  return &data;
89              }              }
90    
91              T* operator ->() throw (LinuxSamplerException) {              T* operator ->() throw (Exception) {
92                  if (!initialized) throw LinuxSamplerException("optional variable not initialized");                  if (!initialized) throw Exception("optional variable not initialized");
93                  return &data;                  return &data;
94              }              }
95    

Legend:
Removed from v.879  
changed lines
  Added in v.880

  ViewVC Help
Powered by ViewVC