[boost] Re: [BoostBook] Guinea pig request

2003-03-27 Thread Remy Blank
On Thu, 27 Mar 2003 10:40:26 -0600 (CST), "William E. Kempf" <[EMAIL PROTECTED]> wrote:
> Problems building:
> 
> * On Mandrake 9.1 I had no issues.
> 
> * On Cygwin, I get the result:
> 
> xslt-xsltproc bin\gcc\debug\boost.docbook
> 'XML_CATALOG_FILES' is not recognized as an internal or external command,
> operable program or batch file.
> 
>   XML_CATALOG_FILES=catalog.xml xsltproc  --xinclude -o
> bin\gcc\debug\boost.docbook 
> C:\cygwin\home\wekempf\boost/tools/boostbook/xsl/docbook.xsl 
> src\boost.xml

XML_CATALOG_FILES={something} xsltproc ...

This is bash syntax for temporarily setting an environment variable for 
the duration of the xsltproc program run. Are you using bash on Cygwin,
or the normal cmd.exe shell? The latter probably doesn't understand this
syntax.

> .failed xslt-xsltproc bin\gcc\debug\boost.docbook...
> 
> I have the following installed under cygwin:
> 
> libxml2 2.4.23-1
> libxslt 1.0.13-1
> 
> At this point, I have no clue how to diagnose the problem.

Probably not related to any of these.

HTH,
-- Remy


Remove anti-spam sequence in reply address for a timely response.




___
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost


[boost] Re: any_cast issues

2003-01-31 Thread Remy Blank
On Fri, 31 Jan 2003 10:12:42 +0200, Greg Dehaas <[EMAIL PROTECTED]> wrote:
> Hi All,
> 
> I'm probably being stoopid, but if someone could point me in the right
> direction, thanks :)
> 
> I've got this:
> 
>   boost::any test = "Test Me";

   boost::any test = std::string("Test Me");

>   int nTest=0;
>   
>   try
>   {
>   nTest = boost::any_cast(test);
>   }
>   catch(const boost::bad_any_cast &)
>   {
>   MessageBox(NULL,"Bad Cast","Bad Cast",0);
>   }
> 
> And the error message is:
> c:\dev\boost\boost\any.hpp(105) : error C2536: 'boost::any::holder [8]>::held' : cannot specify explicit initializer for arrays
> c:\dev\boost\boost\any.hpp(122) : see declaration of 'held'
> c:\dev\boost\boost\any.hpp(103) : while compiling class-template
> member function '__thiscall boost::any::holder [8]>::boost::any::holder(const char (&)[8])'

HTH,
--Remy


Remove anti-spam sequence in reply address for a timely response.




___
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost



[boost] Re: Implicit conversions in dynamic_any / extract

2002-11-25 Thread Remy Blank
Alexander Nasonov wrote:
> You can create your own framework for dynamic_any using
> dynamic_any::function. In a combination with simple and typesafe interface
> it could make great library. Basic idea is here:
> 
> namespace your_framework
> {
>   // ...
>   namespace detail
>   {
> // ...
> struct raw_convert
>   : boost::dynamic_any::function
> <
>   convert,
>   void * (boost::dynamic_any::arg &)
> >

I checked out dynamic_any from CVS but the function<...> syntax seems to be
missing, so I replaced it by function1<...>. Is there something missing in
the repository?

> {
>   raw_convert(const std::type_info & convert_to);
> 
>   template
>   void * call(T & content)
>   {
> const std::type_info & convert_from = typeid(T);
> convert_function fun =
>   lookup_convert_function(convert_from, convert_to_);
> return fun(&content);
>   }
>   // ...
> };
> 
>   } // namespace detail
> 
>   typedef boost::dynamic_any::any<
> boost::mpl::list
>   > any;
> 
>   template
>   T extract(any & a)
>   {
> const std::type_info & convert_to = typeid(T):
> void * raw_ptr = detail::raw_convert(convert_to)(a);
> // ... (various checks)
> T * ptr = (T *) raw_ptr;
> return *ptr;
>   }
> 
> }

After some trimming, this works perfectly! 
dynamic_any is truly awesome!

Thanks for the advice.
Best regards.
--Remy


Remove anti-spam sequence in reply address for a timely response.


___
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost



[boost] Metaclass and reflection framework (was: Implicit conversionsindynamic_any / extract)

2002-11-25 Thread Remy Blank
On Fri, 22 Nov 2002 18:22:59 -0500, David Abrahams <[EMAIL PROTECTED]> wrote:
> Remy Blank <[EMAIL PROTECTED]> writes:
> > That was the goal of the library I am trying to develop.
> 
> I'm trying to imagine what you have in mind. How could this library be
> used? Why would one use your library vs., for example, Boost.Python?

I would like to develop a metaclass and reflection framework.
Intended use: serialization, distant object invocation, integration with
other languages.

I would like to expose the following information using a "describe" scheme:
 - Inheritance information
 - Class attributes
 - Member functions

Attributes should be accessed either by pointer to member, or using getter 
and setter member functions. I imagine a functionality quite close to
Delphi's "published properties and methods".

And obviously I would like to:
 - instantiate objects of specific classes
 - iterate through the attributes of an object
 - access and modify objects through their attributes
 - invoke member functions, from C++ but also from other languages

I'm really only at the very beginning of this project, so I'm currently 
searching for information and previous work on the subject. Boost.Python
seemed to already provide lots of functionality in this direction, but
as you wrote, accessible from Python.

BTW, if anybody has feedback about what a metaclass and reflection framework 
should provide to be usable, please feel free to comment.

Best regards.
--Remy


Remove anti-spam sequence in reply address for a timely response.





___
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost



[boost] Re: Re: Implicit conversions in dynamic_any / extract

2002-11-22 Thread Remy Blank
On Fri, 22 Nov 2002 11:10:19 -0500, David Abrahams <[EMAIL PROTECTED]> wrote:
> Remy Blank <[EMAIL PROTECTED]> writes:
> > I have looked at Boost.Python, and it is very similar to what I had in
> > mind. Would it be possible to make Boost.Python more general to describe
> > C++ class information for runtime use, and have Boost.Python be a
> > subset?
> 
> ?? There's no way that Boost.Python could be a subset of the facility
> we're talking about. It does way, way more than casting around an
> inheritance hierarchy. IOW, it's already way more general.

This is not what I meant. The word "subset" was badly chosen. Sorry
for the confusion.

As I understand, Boost.Python features a class description and object 
management framework, which allows to describe the type of a class, its 
inheritance, the members it contains, and to instantiate, access and 
modify objects of these classes. This can be called an "introspection
and object management facility", can't it? That was the goal of the 
library I am trying to develop.

Looking at Boost.Python, I saw that much (if not all) I needed was 
already there, and much more. So my question was: could the "introspection
and object management" parts be separated from the Python-specific code?

Agreed, my question was badly formulated.

> > I don't have a lot of time on my hands, but if you think this would
> > be a good idea, I would love to give it a try (except that I'm a
> > little scared by Boost.Python's complexity, and I don't know Python
> > (yet)).
> 
> I don't understand. The stuff in inheritance.cpp doesn't touch Python
> at all. It's pure C++.

I haven't yet looked at inheritance.cpp, but your comment confirms that
there is some very generic, not Python-dependent, code in Boost.Python
that provides the functionality needed for an introspection framework.

Anyway, I'll dive into inheritance.cpp and friends, and if positive, I'll
come back with a proposal.

Thanks for your answers!
Best regards.
--Remy



Remove anti-spam sequence in reply address for a timely response.





___
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost



[boost] Re: Implicit conversions in dynamic_any / extract

2002-11-22 Thread Remy Blank
On Fri, 22 Nov 2002 07:17:24 -0500, David Abrahams <[EMAIL PROTECTED]> wrote:
> Remy Blank <[EMAIL PROTECTED]> writes:
> 
> > Hello Boosters,
> >
> > I am trying to use dynamic_any to store either objects or pointers to 
> > (polymorphic) objects.
> >
> > I am able to extract a pointer to the base class of a contained object:
> >
> > class B { };
> >
> > class D: public B { };
> >
> > void Test()
> > {
> > any d(D());
> >
> > B* pb = extract(&d);
> > }
> >
> > This is alread quite useful. However the following code does not work:
> >
> > void Test2()
> > {
> > D d;
> > any pd(&d);
> >
> > B* pb = extract(pd);// pb = 0
> >
> > char c;
> > any AnyChar(c);
> >
> > int i = extract(AnyChar);  // bad_extract
> > }
> >
> > So I have to know the exact type of the contained object and cannot 
> > rely on implicit conversions (D* -> B* or char -> int) to work.
> > This is quite understandable from the fact that any wraps non-class
> > types into unrelated classes.
> >
> > Now my question: is there a way to make these implicit conversions work?
> 
> Heh. Boost.Python does it with a complicated class registry and
> upcast/downcast system. I don't know if you want to pay for that.

Yes, if there's no better way.

> > My best answer at the moment: explicitly register conversion functions
> > from one type to the other in a map, 
>void* (*)(void*)>
> > and look up the right function based on the type contained and the 
> > type requested.
> 
> Oh, well, if you're willing to do that...

I didn't say that. I said that that was my best current answer. I'm not 
satisfied with it, though.

> > But there has to be a better way, hasn't it?
> 
> Yes**. The mechanism in Boost.Python  allows you to register just the
> relationships between adjacent base and derived classes, and it fills
> in the rest of the graph. Maybe it's time to refactor this code for
> general use in Boost...

This sounds good. I'm trying to develop an introspection framework for
C++ classes (and later dynamically created classes), so I will already 
have the inheritance information. I expect your implementation makes 
heavy use of typeid() and dynamic_cast<>?

Other conversions would have to be registered explicitly (char -> int,
char const* -> std::string, ...), possibly half-automated by using
typelists and mpl algorithms.

It's too bad that we have to replicate at runtime what the compiler
already knows how to do at compile time (namely navigating inheritance
hierarchies)...

I have looked at Boost.Python, and it is very similar to what I had in
mind. Would it be possible to make Boost.Python more general to describe
C++ class information for runtime use, and have Boost.Python be a subset?
I don't have a lot of time on my hands, but if you think this would be a
good idea, I would love to give it a try (except that I'm a little scared
by Boost.Python's complexity, and I don't know Python (yet)).

BTW, how does Boost.Python compare to SWIG (http://www.swig.org/) ?
It seems to supports Python, amongst others.

> The code is in libs/python/src/object/inheritance.cpp.

I'll look into that. Thanks for the pointer.

Best regards.
--Remy



Remove anti-spam sequence in reply address for a timely response.





___
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost



[boost] Implicit conversions in dynamic_any / extract

2002-11-22 Thread Remy Blank
Hello Boosters,

I am trying to use dynamic_any to store either objects or pointers to 
(polymorphic) objects.

I am able to extract a pointer to the base class of a contained object:

class B { };

class D: public B { };

void Test()
{
any d(D());

B* pb = extract(&d);
}

This is alread quite useful. However the following code does not work:

void Test2()
{
D d;
any pd(&d);

B* pb = extract(pd);// pb = 0

char c;
any AnyChar(c);

int i = extract(AnyChar);  // bad_extract
}

So I have to know the exact type of the contained object and cannot 
rely on implicit conversions (D* -> B* or char -> int) to work.
This is quite understandable from the fact that any wraps non-class
types into unrelated classes.

Now my question: is there a way to make these implicit conversions work?

My best answer at the moment: explicitly register conversion functions
from one type to the other in a map, void* 
(*)(void*)>
and look up the right function based on the type contained and the 
type requested.

But there has to be a better way, hasn't it?

Best regards.
--Remy


Remove anti-spam sequence in reply address for a timely response.





___
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost



[boost] Re: Possible Boost addition; Ditto framework

2002-11-08 Thread Remy Blank
Hi Martijn,

I am very interested in your library, and took a few minutes to look at it.
I have one comment: in table::insert(), you allocate a new T(d). But you
don't seem to de-allocate it in table::erase(). Isn't this a memory leak?

OTOH, maybe the 10 minutes I spent looking at the code weren't enough to
understand it...

Best regards.
--Remy Blank


On Thu, 7 Nov 2002 19:30:20 +0100, "Martijn W. van der Lee" <[EMAIL PROTECTED]> wrote:
> Hi,
> 
> I've been quietly working on a framework which I think could make a nice
> addition to Boost. Currently it compiles on Borland C++ 5.5.1 and GCC 2.95.3
> (Dev-C++/MinGW) and seems to be stable (though the testcases are not 100%
> implemented yet).
> 
> In short it is an in-memory generic table and view framework where a "table"
> class contains records similar to a database table and "view" classes
> contain sorted and filtered (by means of functors) version of that table.
> These views are updated dynamically so adding a record to the table will
> automatically make it available in all views.
> Furthermore, views can be stacked to allow multiple levels of refinement,
> single records can be selected by using a "tracker" class and events can be
> triggered on any change in the frameworks' classes by means of a "monitor"
> class.
> 
> The original purpose of this library was to replace Borlands' VCL mechanism
> which requires data to be located inside the class handling the visual
> layout, this made it extremely difficult to have multiple separate views of
> the same set of data, the Ditto framework succesfully eliminated this
> problem at the cost of recreating the visual components but with the benefit
> of performance, memory requirements and especially code quality.
> 
> The project is published at sourceforge; http://ditto.sourceforge.net but
> the site is a bit outdated and documentation is especially lacking, the
> current version in CVS is stable and can be downloaded from the project page
> at http://sourceforge.net/projects/ditto
> 
> There are currently still some minor issues with the library (mostly the
> need to specify a dummy filter functor to views when no filter is required)
> but with some help (hint! hint!) I believe the framework could be in a
> finished state within weeks.
> 
> regards,
> Martijn van der Lee
> 
> 
> 
> 
> 
> 
> ___
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
> 


Remove anti-spam sequence in reply address for a timely response.





___
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost