octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: default constructor and class


From: Marco Vassallo
Subject: RE: default constructor and class
Date: Tue, 9 Jul 2013 00:29:30 +0200

________________________________
> Date: Mon, 8 Jul 2013 16:15:55 -0400 
> Subject: Re: default constructor and class 
> From: address@hidden 
> To: address@hidden 
> CC: address@hidden 
>  
> On Mon, Jul 8, 2013 at 4:07 PM, Marco Vassallo  
> <address@hidden<mailto:address@hidden>> wrote: 
> > 
> > 
> > To be honest, it's hard to help without more concrete information. But 
> > if class A does not provide a public/protected constructor, maybe it 
> > provides another constructor that accepts argument. If it does not, 
> > then it means class A was not intended to be used directly and you're 
> > misusing it. 
> > 
> Class A provides other constructors, but as the default constructor is  
> needed only for the 
> Octave functions 
>  
> DEFINE_OCTAVE_ALLOCATOR (myclass); 
> DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (myclass, "myclass", "myclass"); 
>  
> I was looking for a solution which avoid to call this functions but  
> still allows me to register 
> myclass in the octave interpreter. 
>  
> Here is the header file [1] 
> and here [2] is how I implemented the class right now. 
>  
> [1]  
> http://fenicsproject.org/documentation/dolfin/1.2.0/cpp/programmers-reference/function/FunctionSpace.html#FunctionSpace
>  
> [2]  
> http://sourceforge.net/p/octave/fem-fenics/ci/default/tree/src/functionspace.h
>  
>  
>  
> Thanks for the pointer. As FunctionSpace does not provide a default  
> constructor, you're not supposed to use like that. So either you  
> provide sensible default values to the constructor of FunctionSpace, or  
> you use a pointer to a FunctionSpace object, so you can construct it  
> only when required (at which point I suppose you'll have the required  
> arguments to provide to the FunctionSpace constructor). 

Thanks for your solution. I was scared that it could not work with the

DEFINE_OCTAVE_ALLOCATOR (myclass); 
DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (myclass, "myclass", "myclass"); 

because when I call this functions I don't have yet the required  
arguments to provide to the FunctionSpace constructor. So probably I 
have to understand better how these functions work.

Thanks again

Marco
 
>  
> Michael. 
>                                         

reply via email to

[Prev in Thread] Current Thread [Next in Thread]