|
From: | Olaf Till |
Subject: | Pointer-map into core Octave? |
Date: | Sun, 4 Mar 2012 21:36:44 +0100 |
User-agent: | Mutt/1.5.20 (2009-06-14) |
Hi, I wonder if this should go into Octave ... a map of pointers, referenced by external keys. Such a thing was mentioned by jwe (https://mailman.cae.wisc.edu/pipermail/octave-maintainers/2008-November/013314.html) in the context of Comedi support, but I don't think it is already implemented (?). Storing pointers to allocated objects could be useful for several things (comedi support, database connections, ...). Some working example code is attached. - organized similar to the database of open files in Octaves src/oct-stream.cc, - avoids linear lookups by keeping track of "holes" in the list of external keys, - not templated, but only for storing (void *), users have to typecast their objects; means that different types of objects may use a common pool of keys (integers), but I think this is o.k. I would try to integrate this into Octave, if it is thought worth. Olaf -- public key id EAFE0591, e.g. on x-hkp://pool.sks-keyservers.net
ptrmap.cc
Description: Text Data
ptrmap.h
Description: Text Data
test.cc
Description: Text Data
signature.asc
Description: Digital signature
[Prev in Thread] | Current Thread | [Next in Thread] |