Screenshot instructions:
Windows
Mac
Red Hat Linux
Ubuntu
Click URL instructions:
Right-click on ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)
You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
(11) |
Nov
(184) |
Dec
(182) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(224) |
Feb
(404) |
Mar
(244) |
Apr
(232) |
May
(162) |
Jun
(193) |
Jul
(174) |
Aug
(161) |
Sep
(170) |
Oct
(283) |
Nov
(310) |
Dec
(130) |
2007 |
Jan
(210) |
Feb
(129) |
Mar
(174) |
Apr
(246) |
May
(269) |
Jun
(212) |
Jul
(229) |
Aug
(202) |
Sep
(190) |
Oct
(194) |
Nov
(172) |
Dec
(128) |
2008 |
Jan
(343) |
Feb
(137) |
Mar
(186) |
Apr
(266) |
May
(156) |
Jun
(147) |
Jul
(140) |
Aug
(78) |
Sep
(128) |
Oct
(126) |
Nov
(100) |
Dec
(106) |
2009 |
Jan
(152) |
Feb
(165) |
Mar
(209) |
Apr
(166) |
May
(97) |
Jun
(152) |
Jul
(159) |
Aug
(196) |
Sep
(151) |
Oct
(107) |
Nov
(128) |
Dec
(64) |
2010 |
Jan
(105) |
Feb
(77) |
Mar
(129) |
Apr
(151) |
May
(126) |
Jun
(97) |
Jul
(86) |
Aug
(99) |
Sep
(64) |
Oct
(88) |
Nov
(59) |
Dec
(91) |
2011 |
Jan
(159) |
Feb
(111) |
Mar
(153) |
Apr
(114) |
May
(88) |
Jun
(201) |
Jul
(158) |
Aug
(124) |
Sep
(101) |
Oct
(149) |
Nov
(160) |
Dec
(68) |
2012 |
Jan
(74) |
Feb
(68) |
Mar
(121) |
Apr
(92) |
May
(172) |
Jun
(100) |
Jul
(85) |
Aug
(65) |
Sep
(74) |
Oct
(105) |
Nov
(76) |
Dec
(21) |
2013 |
Jan
(101) |
Feb
(57) |
Mar
(76) |
Apr
(35) |
May
(43) |
Jun
(50) |
Jul
(32) |
Aug
(50) |
Sep
(33) |
Oct
(58) |
Nov
(26) |
Dec
(49) |
2014 |
Jan
(46) |
Feb
(49) |
Mar
(54) |
Apr
(33) |
May
(46) |
Jun
(57) |
Jul
(34) |
Aug
(36) |
Sep
(69) |
Oct
(37) |
Nov
(27) |
Dec
(57) |
2015 |
Jan
(25) |
Feb
(52) |
Mar
(97) |
Apr
(41) |
May
(44) |
Jun
(36) |
Jul
(27) |
Aug
(33) |
Sep
(29) |
Oct
(45) |
Nov
(23) |
Dec
(23) |
2016 |
Jan
(6) |
Feb
(31) |
Mar
(17) |
Apr
(41) |
May
(31) |
Jun
(51) |
Jul
(20) |
Aug
(36) |
Sep
(69) |
Oct
(55) |
Nov
(29) |
Dec
(17) |
2017 |
Jan
(25) |
Feb
(22) |
Mar
(29) |
Apr
(18) |
May
(30) |
Jun
(13) |
Jul
(22) |
Aug
(12) |
Sep
(20) |
Oct
(60) |
Nov
(36) |
Dec
(20) |
2018 |
Jan
(16) |
Feb
(12) |
Mar
(25) |
Apr
(12) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
S | M | T | W | T | F | S |
---|---|---|---|---|---|---|
|
|
|
|
|
|
1
(1) |
2
|
3
(1) |
4
(6) |
5
(14) |
6
(4) |
7
(11) |
8
(15) |
9
(4) |
10
(9) |
11
(19) |
12
(20) |
13
(10) |
14
(8) |
15
(4) |
16
|
17
(6) |
18
(6) |
19
(3) |
20
(4) |
21
(1) |
22
(1) |
23
|
24
(5) |
25
(10) |
26
(16) |
27
(8) |
28
(2) |
29
(4) |
30
(1) |
31
(3) |
|
|
|
|
|
From: Jochen Kempf <jochenkempf@gm...> - 2009-08-11 22:06:47
|
Hi, I am trying to make a ruby wrapper for the libfprint<http://reactivated.net/fprint/wiki/Libfprint>library (finger scanning) following the swig documentation for ruby. I can compile the swig interface and finally require the corresponding module successfully. But once I try to call the init() function defined as a library in the c header file I get the following error: irb(main):001:0> require 'rbfprint' > => true > irb(main):002:0> Rbfprint.fp_init > irb: symbol lookup error: ./rbfprint.so: undefined symbol: fp_init This is the corresponding section of the c header file: /* Library */ > int fp_init(void); > void fp_exit(void); > void fp_set_debug(int level); And this is the corresponding section of the wrapper: rb_define_module_function(mRbfprint, "fp_init", _wrap_fp_init, -1); Can anyone help me out? Jochen |
From: Xin Shuai <xshuai@um...> - 2009-08-11 21:55:00
|
Great, it worked when I executed my python script from Terminal. But it didn't work when I just ran from Python Shell. I think Python Shell may not a standard input/output device for cin/cout to work. By the way, both cin and cout are predefined and wrapped in <std_iostream.i>. Thus I think there's no need to specially create some wrapping functions to get them. Up to now, I think what I'v learned from you is enough to deal with I/O stream in Python. But I still have to wrap the same functions in Perl. There's no such "std_iostream.i" in swig for Perl. (I am also curious about why swig doesn't provide it for Perl). I think to achieve similar function in Perl is much more difficult than Python. Do you have any advice about Perl? On Tue, Aug 11, 2009 at 3:13 PM, Ben Webb <ben@...> wrote: > Xin Shuai wrote: > >> Thank you, Ben, for helping me solved a big problem. Now I can >> input/output data through files in Python. >> >> However, I'm wondering can I input/output just through the Python Shell >> still using the read/print paired function, without any other external >> files? Just like cin/cout in C++? >> > > I'd say the easiest way to do that is to define your methods with an > optional argument, i.e. > > std::istream & read (std::istream &s = std::cin) > std::ostream & print (std::ostream &s = std::cout) const > > Then you can simply call them in Python with no arguments and they'll use > standard input/output. Alternatively, if you don't want to change your > methods you could write a simple pair of functions which return wrapped > versions of std::cin and std::cout (or any other existing C++ stream) to use > in Python, e.g. with something like > > %inline %{ > std::istream & get_cin() { return std::cin }; > std::ostream & get_cout() { return std::cout }; > %} > > in your .i file; then you should be able to do something like the following > in your Python interpreter and have the output show up on the screen: > > import libsequence > fasta = libsequence.Fasta(...) > cout = libsequence.get_cout() > fasta.print(cout) > > If you want to use the "real" Python stdout (i.e. sys.stdout) that's a bit > more complicated, but as I said earlier I do have adapters for that if you > want them. > > > Ben > -- > ben@... http://salilab.org/~ben/ > "It is a capital mistake to theorize before one has data." > - Sir Arthur Conan Doyle > -- Xin Shuai (David) PhD of Complex System in School of Informatics Indiana University Bloomington 812-606-8019 |
From: Ben Webb <ben@sa...> - 2009-08-11 19:13:24
|
Xin Shuai wrote: > Thank you, Ben, for helping me solved a big problem. Now I can > input/output data through files in Python. > > However, I'm wondering can I input/output just through the Python Shell > still using the read/print paired function, without any other external > files? Just like cin/cout in C++? I'd say the easiest way to do that is to define your methods with an optional argument, i.e. std::istream & read (std::istream &s = std::cin) std::ostream & print (std::ostream &s = std::cout) const Then you can simply call them in Python with no arguments and they'll use standard input/output. Alternatively, if you don't want to change your methods you could write a simple pair of functions which return wrapped versions of std::cin and std::cout (or any other existing C++ stream) to use in Python, e.g. with something like %inline %{ std::istream & get_cin() { return std::cin }; std::ostream & get_cout() { return std::cout }; %} in your .i file; then you should be able to do something like the following in your Python interpreter and have the output show up on the screen: import libsequence fasta = libsequence.Fasta(...) cout = libsequence.get_cout() fasta.print(cout) If you want to use the "real" Python stdout (i.e. sys.stdout) that's a bit more complicated, but as I said earlier I do have adapters for that if you want them. Ben -- ben@... http://salilab.org/~ben/ "It is a capital mistake to theorize before one has data." - Sir Arthur Conan Doyle |
From: Xin Shuai <xshuai@um...> - 2009-08-11 18:57:17
|
Thank you, Ben, for helping me solved a big problem. Now I can input/output data through files in Python. However, I'm wondering can I input/output just through the Python Shell still using the read/print paired function, without any other external files? Just like cin/cout in C++? On Tue, Aug 11, 2009 at 11:51 AM, Ben Webb <ben@...> wrote: > Xin Shuai wrote: > >> Thank you for sharing your advice that really inspired me. But my >> original C++ istream/ostream function is different form Adam's: >> >> std::istream & read (std::istream &s) >> std::ostream & print (std::ostream &s) const >> >> The above paired functions are member fucntions belonging to many classes >> defined in libsequence library. Using your method, Adam can pass a file with >> istream type to the function and return a usable object. >> But my function, like 'read' only receives a istream object and return >> another istream value. I still don't know use it in Python. >> > > You can just ignore the return value, since it is of no use to Python (it's > just the same istream you passed in, anyway). So you could use it with > something like > > import libsequence > fasta = libsequence.Fasta(...) > fh = libsequence.ifstream("infile.fsa") > fasta.read(fh) # ignore return value > > For your print methods, you can define a simple ofstream wrapper for Python > in a similar way to the ifstream wrapper already demonstrated. > > > Ben > -- > ben@... http://salilab.org/~ben/ > "It is a capital mistake to theorize before one has data." > - Sir Arthur Conan Doyle > -- Xin Shuai (David) PhD of Complex System in School of Informatics Indiana University Bloomington 812-606-8019 |
From: Xin Shuai <xshuai@um...> - 2009-08-11 18:41:40
|
Oh, I see . just calling .flush() and I can see the result at once! On Tue, Aug 11, 2009 at 2:38 PM, Xin Shuai <xshuai@...> wrote: > Oh. Yes, it is there after I quit Python. Thank you for point out such > obvious problem. I seldom use iostream in C++, so I'm not aware of it. > By the way, you point out flushed the stream, is there anyway I can do it > in Python so the output characters can shown immediately? > > > On Tue, Aug 11, 2009 at 2:00 PM, Josh Cherry <jcherry@...>wrote: > >> >> >> On Tue, 11 Aug 2009, Xin Shuai wrote: >> >> I created a null file out.txt, and then I run: >>> >>>> fas = Fasta('n1','ATG') >>>>>> fh = ofstream("out.txt") >>>>>> fas._print(fh) >>>>>> >>>>> <biolib.libsequence.ostream; proxy of <Swig Object of type >>> 'std::basic_ostream<char,std::char_traits<char > > *' at 0x10a2e00> > >>> >>> But when I opened out.txt, nothing is written. >>> >> >> If you did exactly that, without exiting Python, I would expect nothing to >> be written yet (you've only written a few characters, and you presumably >> haven't flushed the stream). Apologies if I'm pointing out the obvious. >> >> Why do you need to create an empty out.txt? >> >> Josh >> >> > > > -- > Xin Shuai (David) > PhD of Complex System in School of Informatics > Indiana University Bloomington > 812-606-8019 > -- Xin Shuai (David) PhD of Complex System in School of Informatics Indiana University Bloomington 812-606-8019 |
From: Xin Shuai <xshuai@um...> - 2009-08-11 18:38:49
|
Oh. Yes, it is there after I quit Python. Thank you for point out such obvious problem. I seldom use iostream in C++, so I'm not aware of it. By the way, you point out flushed the stream, is there anyway I can do it in Python so the output characters can shown immediately? On Tue, Aug 11, 2009 at 2:00 PM, Josh Cherry <jcherry@...>wrote: > > > On Tue, 11 Aug 2009, Xin Shuai wrote: > > I created a null file out.txt, and then I run: >> >>> fas = Fasta('n1','ATG') >>>>> fh = ofstream("out.txt") >>>>> fas._print(fh) >>>>> >>>> <biolib.libsequence.ostream; proxy of <Swig Object of type >> 'std::basic_ostream<char,std::char_traits<char > > *' at 0x10a2e00> > >> >> But when I opened out.txt, nothing is written. >> > > If you did exactly that, without exiting Python, I would expect nothing to > be written yet (you've only written a few characters, and you presumably > haven't flushed the stream). Apologies if I'm pointing out the obvious. > > Why do you need to create an empty out.txt? > > Josh > > -- Xin Shuai (David) PhD of Complex System in School of Informatics Indiana University Bloomington 812-606-8019 |
From: David Piepgrass <dpiepgrass@me...> - 2009-08-11 18:19:02
|
No. I think the only way is the command-line argument, -namespace Namespace.Name -----Original Message----- From: fevans [mailto:fevans@...] Sent: Monday, August 10, 2009 4:45 PM To: swig-user@... Subject: [Swig-user] Defining C# -namespace attribute in the interface file Is there any way to specify the namespace for C# within the SWIG interface file? Any variable I can define? Thanks in advance. -- View this message in context: http://www.nabble.com/Defining-C---namespace-attribute-in-the-interface-file-tp24908887p24908887.html Sent from the swig-user mailing list archive at Nabble.com. ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Swig-user mailing list Swig-user@... https://lists.sourceforge.net/lists/listinfo/swig-user |
From: Josh Cherry <jcherry@nc...> - 2009-08-11 18:00:30
|
On Tue, 11 Aug 2009, Xin Shuai wrote: > I created a null file out.txt, and then I run: >>>> fas = Fasta('n1','ATG') >>>> fh = ofstream("out.txt") >>>> fas._print(fh) > <biolib.libsequence.ostream; proxy of <Swig Object of type > 'std::basic_ostream<char,std::char_traits<char > > *' at 0x10a2e00> > > > But when I opened out.txt, nothing is written. If you did exactly that, without exiting Python, I would expect nothing to be written yet (you've only written a few characters, and you presumably haven't flushed the stream). Apologies if I'm pointing out the obvious. Why do you need to create an empty out.txt? Josh |
From: Xin Shuai <xshuai@um...> - 2009-08-11 17:04:45
|
Yes, it works for 'read' now. But when I handle the 'print' in the similar way: namespace std { class ifstream : public istream { public: ifstream(const char *fname); ~ifstream(); }; class ofstream : public ostream { public: ofstream(const char *fname); ~ofstream(); }; } I created a null file out.txt, and then I run: >>> fas = Fasta('n1','ATG') >>> fh = ofstream("out.txt") >>> fas._print(fh) <biolib.libsequence.ostream; proxy of <Swig Object of type 'std::basic_ostream<char,std::char_traits<char > > *' at 0x10a2e00> > But when I opened out.txt, nothing is written. On Tue, Aug 11, 2009 at 11:51 AM, Ben Webb <ben@...> wrote: > Xin Shuai wrote: > >> Thank you for sharing your advice that really inspired me. But my >> original C++ istream/ostream function is different form Adam's: >> >> std::istream & read (std::istream &s) >> std::ostream & print (std::ostream &s) const >> >> The above paired functions are member fucntions belonging to many classes >> defined in libsequence library. Using your method, Adam can pass a file with >> istream type to the function and return a usable object. >> But my function, like 'read' only receives a istream object and return >> another istream value. I still don't know use it in Python. >> > > You can just ignore the return value, since it is of no use to Python (it's > just the same istream you passed in, anyway). So you could use it with > something like > > import libsequence > fasta = libsequence.Fasta(...) > fh = libsequence.ifstream("infile.fsa") > fasta.read(fh) # ignore return value > > For your print methods, you can define a simple ofstream wrapper for Python > in a similar way to the ifstream wrapper already demonstrated. > > > Ben > -- > ben@... http://salilab.org/~ben/ > "It is a capital mistake to theorize before one has data." > - Sir Arthur Conan Doyle > -- Xin Shuai (David) PhD of Complex System in School of Informatics Indiana University Bloomington 812-606-8019 |
From: Ben Webb <ben@sa...> - 2009-08-11 15:51:50
|
Xin Shuai wrote: > Thank you for sharing your advice that really inspired me. But my > original C++ istream/ostream function is different form Adam's: > > std::istream & read (std::istream &s) > std::ostream & print (std::ostream &s) const > > The above paired functions are member fucntions belonging to many > classes defined in libsequence library. Using your method, Adam can pass > a file with istream type to the function and return a usable object. > > But my function, like 'read' only receives a istream object and return > another istream value. I still don't know use it in Python. You can just ignore the return value, since it is of no use to Python (it's just the same istream you passed in, anyway). So you could use it with something like import libsequence fasta = libsequence.Fasta(...) fh = libsequence.ifstream("infile.fsa") fasta.read(fh) # ignore return value For your print methods, you can define a simple ofstream wrapper for Python in a similar way to the ifstream wrapper already demonstrated. Ben -- ben@... http://salilab.org/~ben/ "It is a capital mistake to theorize before one has data." - Sir Arthur Conan Doyle |
From: <zhongli.xu@no...> - 2009-08-11 15:26:09
|
Hi all, I tried using the Java director feature of SWIG and encountered a problem. I have enabled the director three times in my project. So there will be three Swig::Director classes in three cpp files. There are also three Swig director wrapper classes, let them be Swig_Director_A, Swig_Director_B, Swig_Director_C. Everything works fine for Swig_Director_A. But for Swig_Director_B and Swig_Director_C, when program finish running, the jenv pointer became ZERO or pointers in jenv->functions are invalid. I checked the code and found that it always failed at these codes: JNIEnvWrapper jnienv(this); // "this" is the current pointer to Swig::Director object. JNIEnv *jenv = jnienv.getJNIEnv(); The jenv pointer will be NULL or some function pointers stored in jenv->functions field are not valid, such as the IsSameObject pointer will be 0x000000c3. In class JNIEnvWrapper, it will use the Swig::Director's JavaVM* swig_jvm_ to get the JNIEnv* jenv_: swig_jvm_->AttachCurrentThread((void **)&jenv_, NULL); My guess the reason cause the problem is that the current thread has exited, which results the invalid pointers in jenv->functions. Anyone has any thoughts? Btw, is it possible to change the Swig::Director to other name in the %feature("director") or %module(director="1") ? Regards, Milo PLEASE READ: The information contained in this e-mail is confidential. If you are not an intended recipient of this e-mail you must not copy, distribute or take any further action in reliance upon it and you should delete it and notify the sender. E-mail is not a secure method of communication. Nomura Securities Co. Ltd Shanghai Representative Office cannot accept responsibility for the accuracy or completeness of this message or any attachment(s). This transmission could contain viruses, be corrupted, destroyed, incomplete, intercepted, lost or arrive late. If verification of this e-mail is sought then please request a hard copy. Unless otherwise stated any views or opinions presented are solely those of the author and do not represent those of Nomura Securities Co. Ltd Shanghai Representative Office. This e-mail is intended for information purposes only and is not a solicitation or offer to buy or sell securities or related financial instruments. |
From: Juan Manuel Alvarez <naicigam@gm...> - 2009-08-11 14:03:10
|
Thanks William! That worked great =o) Then thing I don't understand is why I have to declare an empty struct like struct Category {}; Thanks! Juan M. On Wed, Aug 5, 2009 at 2:43 AM, William S Fulton<wsf@...> wrote: > Juan Manuel Alvarez wrote: >> >> Hello everyone! >> >> I am having a problem wrapping a smart pointer defined with a typedef >> like follows: >> typedef boost::shared_ptr<Category> CategoryPtr; >> >> In my C++ code I am using CategoryPtr like a type like this: >> CategoryPtr getCategory (int i); >> >> The problem is: no matter how I use SWIG_SHARED_PTR, when I wrap the >> function above, SWIG generates me a SWIGTYPE_p_CategoryPtr type. >> I have also tried using a typedef before the SWIG_SHARED_PTR >> declaration without success. >> >> My target language is C#. >> > > Not sure what you are doing wrong. Here is a simple example that works fine: > > > %module example > > %include <boost_shared_ptr.i> > > SWIG_SHARED_PTR(Category, Category) > > %inline %{ > #include <boost/shared_ptr.hpp> > struct Category {}; > typedef boost::shared_ptr<Category> CategoryPtr; > CategoryPtr getCategory (int i) { return CategoryPtr(new Category()); } > %} > > > William > |
From: Vadim Zeitlin <vz-swig@ze...> - 2009-08-11 13:29:19
|
On Sat, 08 Aug 2009 23:04:16 +0100 William S Fulton <wsf@...> wrote: WSF> Vadim Zeitlin wrote: WSF> > Hello, WSF> > WSF> > I'd like to ask if anyone has any idea about the following problem: when WSF> > using SWIG 1.3.39 under Windows, I get stray "$directorconnect" fragments ... WSF> The banner shows you are using 1.3.29, not 1.3.39. Directors only WSF> appeared in 1.3.30, so please check you really are using 1.3.39 as you WSF> could easily have your path set up incorrectly. Hello, I'm awfully sorry, you're, of course, completely right and there is no problem with SWIG whatsoever, I simply set up a shell alias to run SWIG 1.3.39 but my makefile used Cygwin swig which was in the PATH. Sorry once again for failing to see my own obvious mistake and blaming SWIG for it and thanks for your answer! VZ |
From: David Beazley <dave@da...> - 2009-08-11 12:45:18
|
Changing the implementation of getattribute is rarely something you want to do in Python regardless of whether or not C extensions are involved. I would strongly advise the use of Python properties or descriptors for this sort of thing. -Dave On Aug 11, 2009, at 6:10 AM, Jonathan Mozes wrote: > Hi, > > I'm wrapping a C++ class into python, that has fields a,b,c, as well > as fields has_a, has_b, and has_c. > The 'has' fields are bolleans, stating whether their corresponding > fields have values in them (basically, a Naïve implementation of a > Nullable primitive). > > I have overrided the __getattribute__ method of the proxy class so > that every call to an attribute will check whether its corresponding > 'has' attribute is True, and return None otherwise. This causes > attribute access to become quite slow, as every python attribute > access goes a few times through the wrapper code – once for the has_ > attribute, one for the base attribute. > > Is there a way to put the __getattribute__ function in C, so its > performance will improve? > > Is there a better design? > > Thanks, > Jon > > > > > > > ************************************************************************************ > This footnote confirms that this email message has been scanned by > PineApp Mail-SeCure for the presence of malicious code, vandals & > computer viruses. > ************************************************************************************ > > ------------------------------------------------------------------------------ > Let Crystal Reports handle the reporting - Free Crystal Reports 2008 > 30-Day > trial. Simplify your report design, integration and deployment - and > focus on > what you do best, core application coding. Discover what's new with > Crystal Reports now. http://p.sf.net/sfu/bobj-july_______________________________________________ > Swig-user mailing list > Swig-user@... > https://lists.sourceforge.net/lists/listinfo/swig-user |
From: Jan Kupec <kupec@ii...> - 2009-08-11 12:28:59
|
Dear community, I would like to kindly ask for advice with the following problem that occurs using any version of swig availiable (on both Linux and Windows): SWIG crashes with a segmentation fault when I try to create the wrapper code of the following i File: ========================= %module CirSimShell %include "std_string.i" class ComponentProperties{ public: ComponentProperties(); ~ComponentProperties(); template <typename T1> void adda(std::string key, T1 val); template <typename T1, typename T2> void adda(std::string key1, T1 val1, std::string key2, T2 val2); template <typename T1, typename T2, typename T3> void adda(std::string key1, T1 val1, std::string key2, T2 val2, std::string key3, T3 val3); }; %extend ComponentProperties{ %template(adda) adda<string, double>; %template(adda) adda<string, string, string>; // ERROR OCCURS HERE } =========================== The crash does not occur when I do not instantiate the member template with three parameters, however, I really need this. Infact, I'd even require to have even more template parameters. I make a wrapper for TCL 8.4, so overloading should be no problem, in fact it works perfectly for one or two template parameters. And it does not word for three or more even if I do not overload adda. In case you have an idea please feel free to reply. I really appreciate your support. Sincerely, Jan Kupec |
From: Jonathan Mozes <jon@ra...> - 2009-08-11 11:38:41
|
Hi, I'm wrapping a C++ class into python, that has fields a,b,c, as well as fields has_a, has_b, and has_c. The 'has' fields are bolleans, stating whether their corresponding fields have values in them (basically, a Naïve implementation of a Nullable primitive). I have overrided the __getattribute__ method of the proxy class so that every call to an attribute will check whether its corresponding 'has' attribute is True, and return None otherwise. This causes attribute access to become quite slow, as every python attribute access goes a few times through the wrapper code - once for the has_ attribute, one for the base attribute. Is there a way to put the __getattribute__ function in C, so its performance will improve? Is there a better design? Thanks, Jon ************************************************************************************ This footnote confirms that this email message has been scanned by PineApp Mail-SeCure for the presence of malicious code, vandals & computer viruses. ************************************************************************************ |
From: Adam A Smith <aasmith@cs...> - 2009-08-11 04:28:21
|
> It's complaining about ifstream, not istream. SWIG only wraps public > constructors, so you'll need to add a "public:" to that ifstream definition > to make it work. You'll probably need a public destructor too, i.e. > > class ifstream : public istream { > public: > ifstream(const char *fname); > ~ifstream(); > }; Thank you. Worked wonderfully, and has solved a major headache. Adam |
From: Ben Webb <ben@sa...> - 2009-08-11 02:14:05
|
Adam A Smith wrote: >>>> bpp.ifstream > <class 'bpp.ifstream'> >>>> bpp.ifstream("seq.txt") > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > File "bpp.py", line 1063, in __init__ > def __init__(self, *args, **kwargs): raise AttributeError, "No > constructor defined" > AttributeError: No constructor defined > > (Incidentally, istream *does* exist, and it has a constructor > declared--though I don't know how to check what it is. I know it takes > a single argument.) > > So the class is behaving like it's abstract. No constructor. Any ideas > why? It's complaining about ifstream, not istream. SWIG only wraps public constructors, so you'll need to add a "public:" to that ifstream definition to make it work. You'll probably need a public destructor too, i.e. class ifstream : public istream { public: ifstream(const char *fname); ~ifstream(); }; Ben -- ben@... http://salilab.org/~ben/ "It is a capital mistake to theorize before one has data." - Sir Arthur Conan Doyle |
From: Adam A Smith <aasmith@cs...> - 2009-08-11 02:08:59
|
> namespace std { > class istream {}; > class ifstream : public istream { > ifstream(const char *fname); > }; > } With this code inserted, I get the following error: swigutils.i:62: Warning(302): Identifier 'istream' redefined (ignored), /usr/share/swig1.3/std/std_iostream.i:321: Warning(302): previous definition of 'istream' (Renamed from 'basic_istream< char >'). This makes some sense, as I've already included std_iostream. I've tried both commenting out "class istream {};", and making it just "class istream;" (sans braces). That compiles fine. But when I try to run it in Python, I get the following (after I import by module bpp): >>> bpp.ifstream <class 'bpp.ifstream'> >>> bpp.ifstream("seq.txt") Traceback (most recent call last): File "<stdin>", line 1, in <module> File "bpp.py", line 1063, in __init__ def __init__(self, *args, **kwargs): raise AttributeError, "No constructor defined" AttributeError: No constructor defined (Incidentally, istream *does* exist, and it has a constructor declared--though I don't know how to check what it is. I know it takes a single argument.) So the class is behaving like it's abstract. No constructor. Any ideas why? Thanks, Adam |