Max 5 API Reference
00001 00002 #ifndef __QUICKMAP_H__ 00003 #define __QUICKMAP_H__ 00004 00005 #if C74_PRAGMA_STRUCT_PACKPUSH 00006 #pragma pack(push, 2) 00007 #elif C74_PRAGMA_STRUCT_PACK 00008 #pragma pack(2) 00009 #endif 00010 00011 00012 /** The quickmap object. This struct is provided for debugging convenience, 00013 but should be considered opaque and is subject to change without notice. 00014 00015 @ingroup quickmap 00016 */ 00017 typedef struct _quickmap { 00018 t_object m_obj; 00019 t_hashtab *m_p1key; 00020 t_hashtab *m_p2key; 00021 } t_quickmap; 00022 00023 00024 #if C74_PRAGMA_STRUCT_PACKPUSH 00025 #pragma pack(pop) 00026 #elif C74_PRAGMA_STRUCT_PACK 00027 #pragma pack() 00028 #endif 00029 00030 00031 BEGIN_USING_C_LINKAGE 00032 00033 /** 00034 Create a new quickmap object. 00035 00036 @ingroup quickmap 00037 @return Pointer to the new quickmap object. 00038 */ 00039 void *quickmap_new(void); 00040 00041 00042 /** 00043 Add a pair of keys mapped to each other to the quickmap. 00044 Note that these are considered to be a #t_symbol internally. 00045 This means that if you are mapping a #t_symbol to a #t_object, for example, the #t_object will not automatically be 00046 freed when you free the quickmap (unlike what happens when you typically free a #t_hashtab). 00047 00048 @ingroup quickmap 00049 00050 @param x The quickmap instance. 00051 @param p1 The (first) key. 00052 @param p2 The value (or the second key). 00053 @return A Max error code. 00054 */ 00055 void quickmap_add(t_quickmap *x, void *p1, void *p2); 00056 00057 00058 /** 00059 Drop a pair of keys mapped to each other in the quickmap. 00060 00061 @ingroup quickmap 00062 00063 @param x The quickmap instance. 00064 @param p1 The first key. 00065 @param p2 The second key. 00066 @return A Max error code. 00067 */ 00068 void quickmap_drop(t_quickmap *x, void *p1, void *p2); 00069 00070 00071 /** 00072 Given a (first) key, lookup the value (the second key). 00073 00074 @ingroup quickmap 00075 00076 @param x The quickmap instance. 00077 @param p1 The (first) key. 00078 @param p2 The address of a pointer which will hold the resulting key upon return. 00079 @return A Max error code. 00080 */ 00081 long quickmap_lookup_key1(t_quickmap *x, void *p1, void **p2); 00082 00083 00084 /** 00085 Given a (second) key, lookup the value (the first key). 00086 00087 @ingroup quickmap 00088 00089 @param x The quickmap instance. 00090 @param p1 The (second) key. 00091 @param p2 The address of a pointer which will hold the resulting key upon return. 00092 @return A Max error code. 00093 */ 00094 long quickmap_lookup_key2(t_quickmap *x, void *p1, void **p2); 00095 00096 00097 /** 00098 Set the readonly flag of the quickmap's hash tables. 00099 See hashtab_readonly() for more information about this. 00100 00101 @ingroup quickmap 00102 00103 @param x The quickmap instance. 00104 @param way Set to true to make the quickmap readonly (disable thread protection) 00105 or false (the default) to enable thread protection. 00106 */ 00107 void quickmap_readonly(t_quickmap *x, long way); 00108 00109 00110 END_USING_C_LINKAGE 00111 00112 #endif // __QUICKMAP_H__
Copyright © 2008, Cycling '74