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
//------------------------------------------------------------------------------
// Luke Titley : from+usd_rs@luketitley.com
//------------------------------------------------------------------------------
use super::layer_handle::LayerHandle;
use cpp::*;

cpp! {{
    #pragma GCC diagnostic push
    #pragma GCC diagnostic ignored "-Wunused-parameter"
    #pragma GCC diagnostic ignored "-Wmissing-field-initializers"
    #include "pxr/usd/sdf/layerUtils.h"
    #pragma GCC diagnostic pop
}}

cpp_class!(
    /// A contiguous block of [LayerHandle] s.
    pub unsafe struct LayerHandleVector as "pxr::SdfLayerHandleVector"
);

impl LayerHandleVector {
    pub fn size(&self) -> usize {
        unsafe {
            cpp!([self as "const pxr::SdfLayerHandleVector *"]
                -> usize as "size_t" {
                return self->size();
            })
        }
    }

    pub fn reserve(&mut self, num: usize) {
        unsafe {
            cpp!([self as "pxr::SdfLayerHandleVector *",
                  num as "size_t"] {
                self->reserve(num);
            })
        }
    }

    pub fn push_back(&mut self, elem: &LayerHandle) {
        unsafe {
            cpp!([self as "pxr::SdfLayerHandleVector *",
                  elem as "const pxr::SdfLayerHandle *"] {
                self->push_back(*elem);
            })
        }
    }

    pub fn clear(&mut self) {
        unsafe {
            cpp!([self as "pxr::SdfLayerHandleVector *"] {
                self->clear();
            })
        }
    }
}