1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
// MCpp_SurfaceImpl.h - MULTICAM C++ API - SurfaceImpl
#if !defined(__MCPP_SURFACEIMPL_H__)
#define __MCPP_SURFACEIMPL_H__
 
#include "MCpp_Surface.h"
 
namespace Euresys
{
  namespace MultiCam
  {
    inline Surface::Surface()
    {
      WRAPPING_MEMBERS_INIT
 
      MCSTATUS status;
      MCHANDLE handle;
 
      status = McCreate(MC_DEFAULT_SURFACE_HANDLE, &handle);
      if (status != MC_OK)
        ThrowMultiCamException(status, TYPE_CREATE, "Surface");
      Handle = handle;
      UserSurface = true;
 
      // Link the MultiCam Surface to this object
      SetParam(MC_sctxt, this);
    }
 
    inline Surface::Surface(MCHANDLE aHandle)
    {
      WRAPPING_MEMBERS_INIT
 
      Handle = aHandle;
      UserSurface = false;
 
      // Link the MultiCam Surface to this object
      SetParam(MC_sctxt, this);
    }
 
    inline Surface::~Surface()
    {
      MCSTATUS status;
 
      if (Handle != 0)
      {
        if (UserSurface)
        {
          status = McDelete(Handle);
          if (status != MC_OK)
            ThrowMultiCamException(status, TYPE_DELETE, "Surface");
        }
        else
        {
          try {
            SetParam(MC_sctxt, (void *)NULL);
          }
          catch (Euresys::MultiCam::Exception &) // MultiCam may already have deleted the surface
          {
          }
        }
      }
      WRAPPING_MEMBERS_UNINIT
    }
 
    // Manual surface reservation
    inline void Surface::Reserve()
    {
      SetParam(MC_SurfaceState, MC_SurfaceState_RESERVED);
    }
 
    inline void Surface::Free()
    {
      SetParam(MC_SurfaceState, MC_SurfaceState_FREE);
    }
  }
}
 
#endif