member

Python: how can I initialize my empty objects ?

how can initialize empty objects in python ? I need to initialize my class members (for examples tk.frames, vtk visualizations etc) thanks ...

Static member object initialization failure

I have a static library with the following code: h file: class Foo { public: Foo() { a = 4; } int a; }; class Bar { public: static const Foo foo; }; cpp file: const Bar::foo = Foo(); My problem is that Bar::foo does not get initialized with a=4 until some time after main(). Before then a=0. I'm trying to ...

c++ (non-built in/class) static member

#include <iostream> #include <string> class c1 { public: static std::string m1; static unsigned int m2; }; //std::string c1::m1 = std::string; unsigned int c1::m2 = 0; void main() { c1 a; //std::cout<<a.m1<<std::endl; std::cout<<a.m2<<std::endl; } In this program enabling the two remarked lines causes an error on the first. ...

static mutable member variables in C++?

Hello, why or for what reason is it not possible to declare a class member variable in C++ as "static mutable"? Something like static mutable int t; //This won't compile For me, there is no reason to ban such declarations. E.g. for reasons like maintaining a global class-wide statistics, it may be convenient to have static variable t...

C++ To call member function in for_each for items in the member container.

If I have a class (that mimic some of STL's container) like this: class Elem { public: void prepare(); // do something on *this // ... }; class Selector { public: typedef vector<Elem *> container_type; typedef container_type::iterator iterator; iterator begin() { return cont_.begin(); } iterator end() { return cont_.end(...

Doxygen: How to document inherited members of a library class

Let's assume the following code: #include <externalLib/bar> /** * Bla blubb bla. */ class Foo : public Bar { ... }; How do I tell doxygen that it should list also the members of the inherited class, even if this is an external class? To be more precise: The external lib is (OpenSceneGraph) also documented via doxygen, but no tag f...

How to check the values in a instance with Python?

I have a python class/object as follows. class Hello: def __init__(self): self.x = None self.y = None self.z = None h = Hello() h.x = 10 h.y = 20 # h.z is not set I need to check if all the member variables are set (not None). How can I do that automatically? for value in ??memeber variables in h??: ...

C++ inline member function in .cpp file

I know that inline member functions by definition should go into the header. But what if it's not possible to put the implementation of the function into the header? Let's take this situation: File A.h #pragma once #include "B.h" class A{ B b; }; File B.h #pragma once class A; //forward declaration class B{ inline A getA(...

C++ call back system. Pointers to member functions.

Hi, Im trying to create a call back by passing a pointer to member functions but am running into all types of issues. How can i go about implementing such a thing template<class T> class A{ void (T::*callBackFunction)(int); public: void addCallBack(void (T::*callBackFunction)(int)){ void (T::*callBackFunction...

Objective C member in C++ class

Hi. Is it possible to have a objective c member in a c++ class @interface ObjectiveCClass : UIViewController { int someVarialbe; } - (void)someFunction; @end class CPlusPlusClass{ ObjectiveCClass obj; // have a objective c member void doSomething(){ obj.someFunction; // and call a objec...

Searching through lists with Scheme (DrRacket)

So here's my code: (define *graph* (read(open-input-file "starbucks4.sxml"))) (define get-artifacts (lambda (l) (member (list 'opm:artifact) l))) When I type get-artifacts(*graph*) I get an error saying procedure application: expected procedure, given:...(the whole of my file contents) Anyone see what I'm doing wrong? Thanks gu...

Using the member function in Scheme

This is my code: (define p (read(open-input-file "starbucks4.sxml"))) (define get-artifacts (lambda (l) (member (list 'opm:artifact) l))) (get-artifacts p) I was told that the member function searches completely throughout a list. In the .sxml document there is a complicated list that has many elements called "opm:artifa...

Basic C++: How do I initialize a struct member of a class?

Hi all. I've looked all over the place, but haven't found an answer to this. I have a C++ class with these protected members: struct tm _creationDate; struct tm _expirationDate; struct tm _lockDate; I want to initialize them at instantiation time. If I put this in the constructor: _creationDate = {0}; _expirationDate = {0}...