OSDN Git Service

リセット
[momiji/momiji_main.git] / Core / Momiji.Core.SafeBuffer.h
1 /*
2 [momiji music component library]
3 ---------------------------------------------------------------------
4 Momiji.Core.SafeBuffer.h
5         safe buffer.
6 ---------------------------------------------------------------------
7 Copyright (C) 2011 tyiki badwell {miria@users.sourceforge.jp}.
8
9 This program is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program.  If not, see <http://www.gnu.org/licenses/gpl-3.0.html>.
21 ---------------------------------------------------------------------
22 */
23 #pragma once
24
25 #using <mscorlib.dll>
26
27 using namespace System::Runtime;
28
29 namespace Momiji{
30 namespace Core {
31
32         //TODO ぜんぜんできてない
33
34         public ref class SafeBuffer:
35                 public InteropServices::SafeBuffer
36         {
37         public:
38                 SafeBuffer(System::UInt32 size):
39                         InteropServices::SafeBuffer(true)
40                 {
41                         this->Initialize(size);
42                 };
43
44         protected:
45                         [ConstrainedExecution::ReliabilityContract(ConstrainedExecution::Consistency::WillNotCorruptState, ConstrainedExecution::Cer::MayFail)]
46                         virtual System::Boolean ReleaseHandle() override
47                         {
48                                 #ifdef _DEBUG
49                                         System::Console::WriteLine("[{0}]",__FUNCTION__);
50                                 #endif
51
52                                 return true;
53                         };
54         };
55
56 }
57 }