[Click] Compile a non-element class in Click

Tushar Soni omega_marines at yahoo.com
Thu Sep 4 06:32:18 EDT 2008


Well as you mentioned, it is a non-element class. So due to this reason it wont be present in elements.conf file.

Now your class will be compiled when there is a call to this class. That could for example creating an object of this class.

Say i have non-element class NEC and it is defined in nec.hh and nec.cc. I have an elemental class called EC and it is defined in ec.hh and ec.cc.

/*ec.hh*/
#ifndef EC_HH
#define EC_HH
//include the necessary headers

#include "nec.hh"

CLICK_DECLS

class EC: public Element
{
    //some code
    NEC _nec_obj,
    //some code
}


CLICK_ENDDECLS
#endif

/*ec.cc*/
//include the necessary header

CLICK_DECLS

//your code

CLICK_DECLS

#include "nec.cc" //this is required if you have functions of the class defined in nec.cc (not required if you have inline functions in nec.hh)

EXPORT_ELEMENT(EC)

Well this is how i am using a non-element class for my code. I hope this helps.

Regards,

Tushar

 
Tºüçhé §übt!é



----- Original Message ----
From: Giovanni Di Stasi <giovanni.distasi at unina.it>
To: Adam Greenhalgh <a.greenhalgh at cs.ucl.ac.uk>
Cc: click at pdos.csail.mit.edu
Sent: Thursday, September 4, 2008 11:52:30 AM
Subject: Re: [Click] Compile a non-element class in Click

On Thursday 04 September 2008 11:40:46 Adam Greenhalgh wrote:
> Have you tried rebuilding the elements list ?
>
> Adam
>
> 2008/9/3 Giovanni Di Stasi <gdistasi at gmail.com>:
> > On Wednesday 03 September 2008 18:34:44 Tushar Soni wrote:
> >> Hi,
> >>
> >> Rename your files to testcompile.hh and testcompile.cc.
> >> According to the FAQs section:
> >>
> >> "Each element class should be written as two C++ source files, FILE.cc
> >> and FILE.hh."
> >>
> >>
> >> I think this holds true for a normal class as well (which is not an
> >> element).
> >
> > Hi,
> > unfortunately, nothing changes after renaming the header file.
> > The file name is not present in elements.conf, and is not compiled.


Yes, with make elemlist...
-- 
Giovanni Di Stasi, Junior Researcher
Dipartimento di Informatica e Sistemistica
Università degli Studi di Napoli "Federico II"
Via Claudio, 21 - 80125 Napoli - Italy

Phone:    +39 081 7683821
Fax:      +39 081 7683816
E-mail:  giovanni.distasi at unina.it

_______________________________________________
click mailing list
click at amsterdam.lcs.mit.edu
https://amsterdam.lcs.mit.edu/mailman/listinfo/click



      



More information about the click mailing list