amino
Lightweight Robot Utility Library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
traj_internal.hpp
Go to the documentation of this file.
1 /* -*- mode: C; c-basic-offset: 4; -*- */
2 /* ex: set shiftwidth=4 tabstop=4 expandtab: */
3 /*
4  * Copyright (c) 2016 Rice University
5  * All rights reserved.
6  *
7  * Author(s): Zachary K. Kingston <zak@rice.edu>
8  *
9  * Redistribution and use in source and binary forms, with or
10  * without modification, are permitted provided that the following
11  * conditions are met:
12  * * Redistributions of source code must retain the above copyright
13  * notice, this list of conditions and the following disclaimer.
14  * * Redistributions in binary form must reproduce the above
15  * copyright notice, this list of conditions and the following
16  * disclaimer in the documentation and/or other materials provided
17  * with the distribution.
18  * * Neither the name of copyright holder the names of its
19  * contributors may be used to endorse or promote products derived
20  * from this software without specific prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
23  * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
24  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
25  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
27  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
29  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
30  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
31  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
33  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34  * POSSIBILITY OF SUCH DAMAGE.
35  *
36  */
37 
38 #ifndef AMINO_CT_TRAJ_INTERNAL_HPP
39 #define AMINO_CT_TRAJ_INTERNAL_HPP
40 
45 #ifdef __cplusplus
46 extern "C" {
47 #endif
48 
52 struct aa_ct_seg;
53 struct aa_ct_seg {
54  int type;
55  int (*eval)(struct aa_ct_seg *seg,
56  struct aa_ct_state *state, double t);
57  struct aa_ct_seg *prev, *next;
58  void *cx;
59 };
60 
61 
69 void aa_ct_seg_list_add(struct aa_ct_seg_list *list, struct aa_ct_seg *seg);
70 
71 #ifdef __cplusplus
72 }
73 #endif
74 
75 #ifdef __cplusplus
76 
77 struct aa_ct_pt_list {
78  struct aa_mem_region reg;
80  amino::RegionList<struct aa_ct_pt *>::type list;
81 
82  aa_ct_pt_list(struct aa_mem_region *_reg) : alloc(_reg), list(alloc) {
83  aa_mem_region_init(&reg, 512);
84  };
85 
86  ~aa_ct_pt_list(void) {
87  list.~list();
89  }
90 };
91 
92 struct aa_ct_seg_list {
93  struct aa_mem_region reg;
95  amino::RegionList<struct aa_ct_seg *>::type list;
96  amino::RegionList<struct aa_ct_seg *>::iterator it;
97  int it_on;
98 
99  aa_ct_seg_list(struct aa_mem_region *_reg) : alloc(_reg), list(alloc) {
100  aa_mem_region_init(&reg, 512);
101  it_on = 0;
102  }
103 
104  ~aa_ct_seg_list(void) {
105  list.~list();
106  aa_mem_region_destroy(&reg);
107  }
108 };
109 
110 #endif
111 
112 #endif
State description of a robot.
Definition: state.h:52
AA_API void aa_mem_region_init(aa_mem_region_t *region, size_t size)
Initialize memory region with an initial chunk of size bytes.
Data Structure for Region-Based memory allocation.
Definition: mem.h:197
int(* eval)(struct aa_ct_seg *seg, struct aa_ct_state *state, double t)
Evaluate function.
int type
Type label for disambiguation.
void aa_ct_seg_list_add(struct aa_ct_seg_list *list, struct aa_ct_seg *seg)
Add a reference to a segment to a segment list.
AA_API void aa_mem_region_destroy(aa_mem_region_t *region)
Destroy memory region freeing all chunks.
An STL allocator that allocates out of a memory region.
Definition: mem.hpp:73
void * cx
Segment context.
struct aa_ct_seg * next
Links to next and previous segments.